home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / TCHK060.LZH / TCHK.DOC < prev    next >
Text File  |  1988-01-15  |  172KB  |  7,458 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           
  8.  
  9.           
  10.  
  11.           
  12.  
  13.           
  14.  
  15.           
  16.  
  17.           
  18.  
  19.           
  20.  
  21.                                  TCHK - a Turbo C library
  22.  
  23.                                        Version 0.60
  24.  
  25.                                   Documentation for TCHK
  26.  
  27.                                             by
  28.  
  29.                                      Howard Kapustein
  30.  
  31.           
  32.  
  33.           
  34.  
  35.                                      Howard Kapustein
  36.  
  37.                                      1695 Barbara Lane
  38.  
  39.                                    East Meadow, NY 11554
  40.  
  41.                                       (516) 481-9612
  42.  
  43.           
  44.  
  45.                           (c) Copyright 1987, All rights reserved
  46.  
  47.           
  48.  
  49.           
  50.  
  51.           
  52.  
  53.           
  54.  
  55.           
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.                                                               Page 1
  138.  
  139.     
  140.     
  141.                                Table of Contents
  142.     
  143.     
  144.     COPYRIGHT AND DISCLAIMER  ..........................................   3
  145.     
  146.     TRADEMARKS  ........................................................   3
  147.     
  148.     LICENSE  ...........................................................   3
  149.     
  150.     BACKGROUND  ........................................................   4
  151.     
  152.     FILES  .............................................................   4
  153.     
  154.     IN THE BEGINNING..  ................................................   5
  155.     
  156.     FEATURES  ..........................................................   5
  157.     
  158.     CREDIT  ............................................................   5
  159.     
  160.     FUNCTIONS  .........................................................   6
  161.          atrim - trims leading and trailing blanks  ....................   9
  162.          ltrim - trims leading blanks  .................................   9
  163.          rtrim - trims trailing blanks  ................................   9
  164.          box - draw a box  .............................................  10
  165.          Cal... - family of Calendar date conversion  ..................  11
  166.          clear - clears a portion of the screen  .......................  12
  167.          clear_typeahead - clear typeahead buffer  .....................  13
  168.          cls - clear screen  ...........................................  14
  169.          cursor_blink - set speed of cursor blink  .....................  15
  170.          cursor_flip - toggle the cursor type  .........................  16
  171.          cursor_off - turn the cursor off  .............................  17
  172.          cursor_on - turn the cursor on  ...............................  18
  173.          dayofweek - find the day of the week  .........................  19
  174.          dayofyear - calculate the day of the year  ....................  20
  175.          daysleft - calculate the days left in the year  ...............  21
  176.          ddatetolong - convert a date to long string  ..................  22
  177.          ddatetoshort - convert a date to short string  ................  23
  178.          ddatetostr - convert a date to abbrev. string  ................  24
  179.          delay - wait for a time delay  ................................  25
  180.          DESQfreeCPU - give up CPU time  ...............................  26
  181.          DESQversion - DESQview/Topview/Taskview version  ..............  27
  182.          diffddate - calculate the difference in 2 dates  ..............  28
  183.          disktype - disk drive type  ...................................  29
  184.          DoubleDOSfreeCPU - give up CPU time under  ....................  30
  185.          DoubleDOSTaskSwitch - set Double DOS task  ....................  31
  186.          EMMversion - version of Expanded Memory Manager  ..............  32
  187.          Extendedtotal - total Extended memory installed  ..............  33
  188.          fulltoddate - convert a full date to struct  ..................  34
  189.          shorttoddate - convert a short date to struct  ................  34
  190.          getc_match - get specific input,  case independent  ...........  35
  191.          getk_match - get specific input, case dependent  ..............  35
  192.          getddate - inputs a date from the keyboard  ...................  36
  193.          getdouble - inputs a double from the keyboard  ................  37
  194.     
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.                                                               Page 2
  204.  
  205.          getfname - get a filename from the keyboard  ..................  38
  206.          getget - get a string from the keyboard w/editing  ............  39
  207.          getint - inputs an integer from the keyboard  .................  40
  208.          getk - get a key  .............................................  41
  209.          getlogical - get Yes/No  ......................................  42
  210.          getreal - inputs a real from the keyboard  ....................  43
  211.          getstr - input a string from the keyboard  ....................  44
  212.          getyn - get Yes/No  ...........................................  46
  213.          gotoxy - move cursor to coordinates (x,y)  ....................  47
  214.          Greg... - family of Gregorian date conversion  ................  48
  215.          horiz_line - draw a horizontal line  ..........................  49
  216.          inkey - get a key  ............................................  50
  217.          intlen - calculate length of integer in a string  .............  51
  218.          isBREAKon - check Ctrl-BREAK flag  ............................  52
  219.          isCGA - is Color Graphics adapter installed  ..................  53
  220.          isEGA - is Enhanced Graphics adapter installed  ...............  53
  221.          isHerc - is Hercules Graphics adapter installed  ..............  53
  222.          isMDA - is Monochrome adapter installed  ......................  53
  223.          isDoubleDOS - is Double DOS active  ...........................  54
  224.          isEMSavail - is EMS available  ................................  55
  225.          isExtended - is Extended memory installed  ....................  56
  226.          isleapyear - is a year a leap year  ...........................  57
  227.          isNetwork - is a network installed  ...........................  58
  228.          isVERIFYon - check VERIFY flag  ...............................  59
  229.          Jul... - family of Julian date conversion  ....................  60
  230.          leftstr - return the left portion of string  ..................  61
  231.          midstr - return a piece of a string  ..........................  61
  232.          rightstr - return the right portion of a string  ..............  61
  233.          lotus_setup - creates info for menu_lotus()  ..................  63
  234.          memory_strategy - get/set memory alloc strategy  ..............  64
  235.          menu_lotus - Lotus style menu  ................................  65
  236.          monthexpand - convert a month abbrev to its name  .............  67
  237.          putk - put a character w/attribute on the screen  .............  68
  238.          putsay - put a string with attribute on the screen  ...........  69
  239.          putstr - put a string with attribute on the screen  ...........  70
  240.          read_cursor - reads cursor information  .......................  71
  241.          read_mode - find screen width, mode and page  .................  72
  242.          reboot - reboots the machine  .................................  73
  243.          restore_box - restore a part of the screen  ...................  74
  244.          restore_screen - restore screen  ..............................  75
  245.          ROM_date - gets the ROM id date  ..............................  76
  246.          ROM_id - gets the ROM id byte  ................................  77
  247.          save_box - save a part of the screen  .........................  78
  248.          save_screen - save screen  ....................................  79
  249.          scrbuff - calculate size of screen buffer  ....................  80
  250.          scroll_down - scroll window down  .............................  81
  251.          scroll_up - scroll window up  .................................  82
  252.          setBREAK - set Ctrl-BREAK flag  ...............................  83
  253.          set_color - set the default attribute (color)  ................  84
  254.          set_cursor - sets cursor scan lines  ..........................  85
  255.          set_handles - set handle count  ...............................  86
  256.          setVERIFY - set VERIFY flag  ..................................  87
  257.          set_mode - set the video mode  ................................  88
  258.     
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.                                                               Page 3
  270.  
  271.          strcomma - convert a string to xx,xxx,xxx format  .............  89
  272.          strdel - delete part of a string  .............................  90
  273.          strins - insert one string into another  ......................  91
  274.          strrep - replicate a char  ....................................  92
  275.          strshleft - shift string left  ................................  93
  276.          strshright - shift string right  ..............................  93
  277.          strtoddate - convert a date string to a structure  ............  94
  278.          strtodol - converts a string to dollar format  ................  95
  279.          strtotime - convert a string to a time structure  .............  96
  280.          timetostr - convert time structure to a string  ...............  97
  281.          valid_date - check if a date is valid  ........................  98
  282.          vert_line - draw a vertical line  .............................  99
  283.          wherex - X-coordinate of cursor   ............................. 100
  284.          wherey - y-coordinate of cursor   ............................. 101
  285.     
  286.     #DEFINES  .......................................................... 102
  287.          Datehk.h  ..................................................... 102
  288.          Filehk.h  ..................................................... 102
  289.          Howard.h  ..................................................... 102
  290.          Ibm.h  ........................................................ 103
  291.          Math.h  ....................................................... 104
  292.          Video.h  ...................................................... 104
  293.     
  294.     VARIABLE TYPES  .................................................... 105
  295.     
  296.     GLOBAL VARIABLES  .................................................. 105
  297.          Datehk variables:  ............................................ 105
  298.          Keyboard variables:  .......................................... 105
  299.          Video variables:  ............................................. 105
  300.     
  301.     REVISION HISTORY  .................................................. 106
  302.     
  303.     FUTURE ENHANCEMENTS  ............................................... 107
  304.     
  305.     APPENDIX A - DATE FORMATS  ......................................... 108
  306.     
  307.     INDEX  ............................................................. 109
  308.     
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                               Page 3
  335.  
  336.     
  337.     
  338.                             COPYRIGHT AND DISCLAIMER
  339.     
  340.           This library and documentation are Copyrighted (C) 1987 by Howard
  341.           Kapustein, All Rights Reserved.
  342.     
  343.           Use of this library acknowledges this disclaimer of warranty:
  344.           "This library is supplied as-is. The author disclaims all
  345.           warranties, expressed or implied, including, without limitation,
  346.           the warranties of merchantability and of fitness of this library
  347.           for any purpose. The author assumes no liability for damages
  348.           direct or consequential, which may result from the use of this
  349.           library."
  350.     
  351.     
  352.     
  353.                                    TRADEMARKS
  354.     
  355.           Macintosh is a registered trademark of Apple Incorporated.
  356.        dBase III+ is a registered trademark of Ashton-Tate Incorporated.
  357.           Turbo C is a registered trademark of Borland International.
  358.                Symphony is a registered trademark of Lotus Corp.
  359.     
  360.     
  361.     
  362.                                     LICENSE
  363.     
  364.           TCHK is distributed as "shareware", as outlined below.
  365.     
  366.           Nonregistered users are granted a limited license to use this
  367.           library for personal, private ends, and may develop software
  368.           using the functions contained herein, but may not distribute,
  369.           sell nor otherwise release or profit from any product made with
  370.           TCHK. Users may become REGISTERED owners for a small pittance of
  371.           $15. Registering has the following benefits:
  372.     
  373.                Registered owners will receive TCHK compiled for use with
  374.                all memory models (not just the small memory model
  375.                distributed here.)
  376.     
  377.                Registered owners are entitled to utilize TCHK in commercial
  378.                applications.
  379.     
  380.                Registered users are registered for all versions of TCHK
  381.                numbered 0.xx and 1.xx. Beyond that I make no guarrantees.
  382.                When I release 1.00 I will decide how I will handle future
  383.                updates. (Check the versions I've released and you'll notice
  384.                I pack a lot in. This isn't such a bad deal.)
  385.     
  386.           REGISTERED owners may purchase the source code to TCHK for $35.
  387.     
  388.           Businesses using TCHK, for whatever reason, MUST register.
  389.     
  390.     
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                                               Page 4
  401.  
  402.           Nonregistered users releasing a program as Public Domain that
  403.           uses TCHK is a violation of the law. Use it by yourself, for
  404.           yourself, for a personal (not business) reason, and you do not
  405.           have to register.
  406.     
  407.     
  408.     
  409.                                    BACKGROUND
  410.     
  411.           I am a student at Rensselaer Polytechnic Institute majoring in
  412.           computer science. I also do consulting/programming work as a
  413.           sideline (hint hint.) When I purchased Turbo C, I wanted to do
  414.           more than bare bones printf(). I was also engaged in designing
  415.           some software requiring the use of dates, and some other unusual
  416.           functions. Thus, after several months of testing and use, I
  417.           developed a rather useful collection of functions. After some 
  418.      requests from other programmers, I decided to bundle most of them
  419.     together and <gasp> document them. This library is a collection of most
  420.     of these functions.
  421.     
  422.     
  423.     
  424.                                      FILES
  425.     
  426.           You may not distribute TCHK except in unmodified form, and it
  427.           must be distributed with all the following files:
  428.     
  429.                TCHKS.LIB      - small memory model library
  430.                TCHK.DOC       - documentation for TCHK
  431.                DEMODATE.C     - demo program of date functions
  432.                DEMODATE.PRJ   - project used to compile DEMODATE.C
  433.                DEMODISK.C     - demo program of disktype function
  434.                DEMODISK.PRJ   - project used to compile DEMODISK.C
  435.                DEMOMENU.C     - demo program of menu functions
  436.                DEMOMENU.PRJ   - project used to compile DEMOMENU.C
  437.                TCHK.TC        - Turbo C configuration file
  438.     
  439.                ANSIHK.H       - header file for ANSI functions
  440.                COLOR.H        - color definitions
  441.                DATEHK.H       - header file for date routines
  442.                FILEHK.H       - header file for file routines
  443.                IBM.H          - header file for misc. IBM routines
  444.                KEYBOARD.H     - header file for keyboard routines
  445.                KEYCODE.H      - keyboard scan codes
  446.                MATHHK.H       - header file of math defines
  447.                MENUHK.H       - header file for menu routines
  448.                MULTIHK.H      - header file for multi-tasking functions
  449.                STRINGHK.H     - header file for string routines
  450.                TIMEHK.H       - header file for time routines
  451.                VIDEO.H        - header file for video routines
  452.     
  453.           To compile the demo programs, use the configuration file TCHK.TC
  454.           and the appropriate project file. Make sure you check the Turbo C
  455.           directories before compiling.
  456.     
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                                               Page 5
  467.  
  468.     
  469.     
  470.     
  471.                               IN THE BEGINNING...
  472.     
  473.           Except where explicitly stated, all of these functions have been
  474.           tested and compiled on my system:
  475.     
  476.                - IBM PC
  477.                - 640K memory
  478.                - (CGA) Color Graphics Adapter
  479.                - DOS 3.2
  480.                - IBM Proprinter XL
  481.     
  482.           TCHK was compiled from the interactive environment of Turbo C,
  483.           with the following options changed from the default:
  484.     
  485.                Optimize on: SPEED
  486.                Memory model: SMALL
  487.     
  488.           For more info, check out the configuration file TCHK.TC.
  489.     
  490.           This library was written in 100% Turbo C, with no use of inline
  491.           Assembly, compiled with Turbo C 1.0 and created with PLIB86.
  492.     
  493.     
  494.     
  495.                                     FEATURES
  496.     
  497.           TCHK sports many useful features not found in other shareware
  498.           packages. Aside from many input and output routines, TCHK is the
  499.           only package I have seen (and I've looked) that supplies date and
  500.           time functions. Also unique to TCHK is the Lotus style slash-bar
  501.           menu function.
  502.     
  503.           Many of the functions requiring output as a side effect (most
  504.           noticeably the keyboard functions) make use of some of the output
  505.           routines prototyped in VIDEO.H. If you use almost any of the
  506.           keyboard routines, expect both the keyboard and the video
  507.           routines to be linked into your program. This is true of some of
  508.           the other routines as well (the lotus menus require the menu,
  509.           keyboard, video and time routines.) Since the entire .LIB file is
  510.           rather small, there is no harm done. Perhaps a future version
  511.           will have the routines segmented more (if you really want to
  512.           break up the library, you can always purchase the source code...)
  513.     
  514.     
  515.     
  516.                                      CREDIT
  517.     
  518.          The following people deserve credit for their help:
  519.     
  520.           James Arnold helping with optimizing the direct video access
  521.                functions.
  522.           Darius Thabit for his help with the reboot function.
  523.     
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                                               Page 6
  533.  
  534.     
  535.     
  536.     
  537.                                    FUNCTIONS
  538.     
  539.           Most of the functions are documented well enough below, although
  540.           I feel a few more explanations are necessary:
  541.     
  542.                In the interactive environment you can #define one item in
  543.                terms of another, including spaces. If anyone knows how to
  544.                do this with the command line version, please let me know.
  545.                The variable type  byte  is just an unsigned char. If you
  546.                use the command line version of TC you will have to change
  547.                the header files of TCHK.
  548.     
  549.                All functions asking for screen coordinates treat the top
  550.                left corner as row zero, column zero (0,0).
  551.     
  552.                Most functions rely on interrupts and low memory addresses
  553.                (400:xxxx) to comply  with the IBM standard. Certain values
  554.                (for instance, the current video page) can be found by an
  555.                interrupt or by peeking at the value stored in low memory.
  556.                Many of the video functions especially require these values
  557.                to be found at the proper places. If your clone is radically
  558.                different from the IBM standard some of these functions may
  559.                not work properly. I didn't want to have to write a million
  560.                small functions that are just background support for the
  561.                functions found here (like current page number, etc.) so I
  562.                used the #defines found in the headers (see video.h for more
  563.                details.)
  564.     
  565.                TCHK has not been tested on a Hercules or MDA video card
  566.                since I do not have access to either piece of hardware,
  567.                although the methods I used are well documented and should
  568.                cause no problems.
  569.     
  570.                All direct screen accesses have built-in snow control. On
  571.                CGA monitors, the snow was horrendous without it. Unless I
  572.                code these routines in assembler, I won't be able to squeeze
  573.                any more optimization out of these routines. I do plan on
  574.                converting these functions to assembler, but I just don't
  575.                have the time right now.
  576.     
  577.           One type of command you will NOT find in TCHK are windowing
  578.           commands. There are plenty of windowing libraries available. You
  579.           should not try to make your poor IBM into a Mac, it won't cut it.
  580.           Splurge for the Mac, you'll be happier. Yes, I know, the
  581.           'windowing' interface is nicer. I use 'windows' too, although
  582.           mine are just boxes. I find it more than suitable for my current
  583.           needs.
  584.     
  585.           The functions are listed in the same manner as the Turbo C
  586.           manual, in alphabetical order.
  587.     
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                                               Page 7
  599.  
  600.     
  601.     Name                 ansi_call - create an ANSI escape sequence
  602.     
  603.     Usage                char *ansi_call(int subfunction, int parm1,
  604.                                          int parm2, char *ansistring);
  605.     
  606.     Prototype in         ansihk.h
  607.     
  608.     Description          ansi_call is a general function that will create
  609.                          an ANSI escape sequence for the given subfunction:
  610.     
  611.                                1:  gotoxy(parm1,parm2)
  612.                                2:  cursor_right
  613.                                3:  cursor_left
  614.                                4:  cursor_up
  615.                                5:  cursor_down
  616.                                6:  save_cursor_position
  617.                                7:  restore_cursor_position
  618.                                8:  cls()
  619.                                9:  clear_eol()
  620.                               10: set_foreground(parm1)
  621.                               11: set_background(parm1)
  622.                               12: clear_attributes         (plain, normal)
  623.                               13: bold
  624.                               14: faint
  625.                               15: italic
  626.                               16: blink
  627.                               17: fast_blink
  628.                               18: inverse
  629.                               19: invisible
  630.                               20: set_mode(parm1)
  631.                               21: reset_mode(parm1)
  632.                               22: wherexy()
  633.     
  634.                              1: moves cursor to (parm1,parm2)
  635.                            2-5: move cursor 1 space in direction indicated
  636.                            6-7: save cursor position for future restoring
  637.                              8: clear screen
  638.                              9: clear to the end of current line
  639.                          10-11: set colors for output
  640.                    12-15,18-19: set attributes for output
  641.                          16-17: control cursor blink rate
  642.                          20-21: change mode (not same as DOS, see ansihk.h)
  643.                             22: outputs the current cursor location
  644.     
  645.                          A value must be passed for parm1 and parm2, even
  646.                          if they are not going to be used.
  647.     
  648.                          The escape sequence ansistring can be outputted
  649.                          with a simple printf().
  650.     
  651.                          Remember, ANSI.SYS, FANSI-CONSOLE, or some similar
  652.                          ANSI control sequence program must be active for
  653.                          these codes to take effect.
  654.     
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                                               Page 8
  665.  
  666.     
  667.     Return value         returns ansistring.
  668.     
  669.     Note                 The color codes needed by ANSI functions are NOT
  670.                          the same as the color codes used by DOS to set
  671.                          attributes. Use the ANSI color #defines given in
  672.                          ansihk.h.
  673.     
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                                               Page 9
  731.  
  732.     
  733.     Name                  atrim - trims leading and trailing blanks
  734.                           ltrim - trims leading blanks
  735.                           rtrim - trims trailing blanks
  736.     
  737.     Usage                char *atrim(char *source);
  738.                          char *ltrim(char *source);
  739.                          char *rtrim(char *source);
  740.     
  741.     Prototype in         stringhk.h
  742.     
  743.     Description          these functions remove leading and/or trailing
  744.                          blanks in a string.
  745.     
  746.     Return value         returns a pointer to the storage location
  747.                          containing the trimmed string, or NULL if space
  748.                          could not be allocated. The returned string is NOT
  749.                          the same as the string passed to the function.
  750.                          This function does NOT write over the string
  751.                          passed to it.
  752.     
  753.     
  754.     Example              #include <stringhk.h>
  755.                          #include <stdio.h>           /* for the printf */
  756.     
  757.                          main()
  758.                          {
  759.                               char msg[25], *trimmed
  760.     
  761.                               strcpy(msg,"  Hello everyone   ");
  762.                               trimmed = ltrim(msg);
  763.                               printf("String [%s]\n",msg);
  764.                               printf("ltrim  [%s]\n",trimmed);
  765.                               free(trimmed);
  766.                               trimmed = rtrim(msg);
  767.                               printf("rtrim  [%s]\n",trimmmed);
  768.                               free(trimmed);
  769.                               trimmed = atrim(msg);
  770.                               printf("atrim  [%s]\n",trimmmed);
  771.                          }
  772.          
  773.     Program output       String [  Hello everyone   ]
  774.                          ltrim  [Hello everyone   ]
  775.                          rtrim  [  Hello everyone]
  776.                          atrim  [Hello everyone]
  777.     
  778.     
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                                                               Page 10
  797.  
  798.     
  799.     Name                  box - draw a box
  800.     
  801.     Usage                int box(int top, int left, int bottom, int right,
  802.                               byte frame[]);
  803.     
  804.     
  805.     Prototype in         video.h
  806.     
  807.     Description          draws a box via INTerrupts.
  808.                          frame must be have at least 9 elements (byte
  809.                          frame[9]). The box characters are frame[0] (top
  810.                          left) to frame[7] (left wall), going clockwise. If
  811.                          frame[8] != '\0' the box is filled with it.
  812.     
  813.     Return value         returns zero upon succesful completion, -1 if
  814.                          invalid coordinates are given.
  815.     
  816.     See also             global variables
  817.                          horiz_line(), restore_box(), restore_screen(),
  818.                          save_box(), save_screen(), vert_line()
  819.     
  820.     Example              #include <video.h>
  821.     
  822.                          main()
  823.                          {
  824.                               byte framebox[9];
  825.     
  826.                               strcpy(framebox,"abcdefghi");
  827.                               box(1,4,4,10,framebox);
  828.                          }
  829.     
  830.     Program output       abbbbbc
  831.                          hiiiiid
  832.                          hiiiiid
  833.                          gfffffe
  834.     
  835.     
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                                                               Page 11
  863.  
  864.     
  865.     Name                  Cal... - family of Calendar date conversion
  866.                                   functions
  867.     
  868.     Usage                char *CaltoGreg(double cal);
  869.                          char *CaltoGregEuro(double cal);
  870.                          char *CaltoGregJap(double cal);
  871.                          double CaltoJul(double cal);
  872.                          double CaltoJulA(double cal);
  873.                          double CaltoJulB(double cal);
  874.                          double CaltoCalCent(double cal);
  875.                          double CalCenttoCal(double cal);
  876.     
  877.     Prototype in         datehk.h
  878.     
  879.     Description          CaltoGreg           converts Calendar date to
  880.                                              Gregorian (US) date
  881.                          CaltoGregEuro       converts Calendar date to
  882.                                              Gregorian (European) date
  883.                          CaltoGregJap        converts Calendar date to
  884.                                              Gregorian (Japan) date
  885.                          CaltoJul            converts Calendar date to
  886.                                              Julian (Type E) date
  887.                          CaltoJulA           converts Calendar date to
  888.                                              Julian (Type A) date
  889.                          CaltoJulB           converts Calendar date to
  890.                                              Julian (Type B) date
  891.                          CaltoCalCent        converts Calendar date to
  892.                                              Calendar date (w/century)
  893.                          CalCenttoCal        converts Calendar date
  894.                                              (w/century) to Calendar date
  895.     
  896.     Return value         CaltoGreg... return the appropriate Gregorian date
  897.                          CaltoJul... return the appropriate Julian date
  898.                          CaltoCalCent returns a Calendar date (w/century)
  899.                          CalCentotCal returns a Calendar date
  900.     
  901.     See also             Appendix A
  902.                          fulltoddate(), Greg...(), Jul...(), shorttoddate()
  903.     
  904.     Example              see demodate.c
  905.     
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                                               Page 12
  929.  
  930.     
  931.     Name                  clear - clears a portion of the screen
  932.     
  933.     Usage                void clear(int top, int left, int bottom, int
  934.                          right);
  935.     
  936.     Prototype in         video.h
  937.     
  938.     Description          clears a box of the screen with INT 0x10, Service
  939.                          6.
  940.     
  941.     Return value         nothing.
  942.     
  943.     See also             cls()
  944.     
  945.     Example              #include <video.h>
  946.     
  947.                          main()
  948.                          {
  949.                               clear(0,0,3,79);  /* clear top 4 lines of
  950.                               screen */
  951.                          }
  952.     
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                                                               Page 13
  995.  
  996.     
  997.     Name                  clear_typeahead - clear typeahead buffer
  998.     
  999.     Usage                int clear_typeahead(void);
  1000.     
  1001.     Prototype in         keyboard.h
  1002.     
  1003.     Description          clears the typeahead buffer and returns the number
  1004.                          of keystrokes cleared
  1005.     
  1006.     Return value         number of keystrokes emptied from the typeahead
  1007.                          buffer
  1008.     
  1009.     Example              #include <keyboard.h>
  1010.                          #include <stdio.h>
  1011.     
  1012.                          main()
  1013.                          {
  1014.                               printf("# keystrokes emptied = %d",
  1015.                                         clear_typeahead());
  1016.                          }
  1017.     
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                                                               Page 14
  1061.  
  1062.     
  1063.     Name                  cls - clear screen
  1064.     
  1065.     Usage                void cls(void);
  1066.     
  1067.     Prototype in         video.h
  1068.     
  1069.     Description          clears screen by INT 0x10, Service 6 (scroll
  1070.                          window up) and resets cursor to (0,0).
  1071.     
  1072.     Return value         nothing.
  1073.     
  1074.     See also             clear()
  1075.     
  1076.     Example              #include <video.h>
  1077.     
  1078.                          main()
  1079.                          {
  1080.                               cls()
  1081.                          }
  1082.     
  1083.     
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                                                               Page 15
  1127.  
  1128.     
  1129.     Name                  cursor_blink - set speed of cursor blink
  1130.     
  1131.     Usage                void cursor_blink(boolean fast);
  1132.     
  1133.     Prototype in         video.h
  1134.     
  1135.     Description          this function will make the cursor blink fast if
  1136.                          fast is TRUE, or slow if fast is FALSE.
  1137.     
  1138.     Return value         nothing.
  1139.     
  1140.     See also             cursor_flip(), cursor_off(), cursor_on(),
  1141.                          read_cursor(), set_cursor()
  1142.     
  1143.     Example              
  1144.     
  1145.     Program output       
  1146.     
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                                                               Page 16
  1193.  
  1194.     
  1195.     Name                  cursor_flip - toggle the cursor type
  1196.     
  1197.     Usage                void cursor_flip(unsigned int curs1, unsigned int
  1198.                          curs2);
  1199.     
  1200.     Prototype in         video.h
  1201.     
  1202.     Description          toggles the cursor scan lines to whichever set the
  1203.                          cursor is not currently set for.
  1204.     
  1205.     Return value         nothing.
  1206.     
  1207.     See also             cursor_blink(), cursor_off(), cursor_on(),
  1208.                          read_cursor(), set_cursor()
  1209.     
  1210.     Example              #include <video.h>
  1211.     
  1212.                          main()
  1213.                          {
  1214.                          cursor_flip(CURSOR_UNDERBAR,CURSOR_HALFBLOCK);
  1215.                          }
  1216.     
  1217.     
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                                                               Page 17
  1259.  
  1260.     
  1261.     Name                  cursor_off - turn the cursor off
  1262.     
  1263.     Usage                void cursor_off(void);
  1264.     
  1265.     Prototype in         video.h
  1266.     
  1267.     Description          makes the cursor invisible.
  1268.     
  1269.     Return value         nothing.
  1270.     
  1271.     See also             cursor_blink(), cursor_flip(), cursor_on(),
  1272.                          read_cursor(), set_cursor()
  1273.     
  1274.     Example              #include <video.h>
  1275.     
  1276.                          main()
  1277.                          {
  1278.                               cursor_off();
  1279.                          }
  1280.     
  1281.     
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                                               Page 18
  1325.  
  1326.     
  1327.     Name                  cursor_on - turn the cursor on
  1328.     
  1329.     Usage                void cursor_on(void);
  1330.     
  1331.     Prototype in         video.h
  1332.     
  1333.     Description          makes the cursor visible. Sets the scan lines to
  1334.                          the default according to the hardware detected.
  1335.     
  1336.     Return value         nothing.
  1337.     
  1338.     See also             cursor_blink(), cursor_flip(), cursor_off(),
  1339.                          read_cursor(), set_cursor()
  1340.     
  1341.     Example              #include <video.h>
  1342.     
  1343.                          main()
  1344.                          {
  1345.                               cursor_on();
  1346.                          }
  1347.     
  1348.     
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                                                               Page 19
  1391.  
  1392.     
  1393.     Name                  dayofweek - find the day of the week
  1394.     
  1395.     Usage                int dayofweek(double jul);
  1396.     
  1397.     Prototype in         datehk.h
  1398.     
  1399.     Description          finds the day of the week for a given Julian
  1400.                          (Type E) date
  1401.     
  1402.     Return value         returns 0-6 (Sun...Sat)
  1403.     
  1404.     See also             Appendix A
  1405.                          datehk.h
  1406.     
  1407.     Example              see demodate.c
  1408.     
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                                                               Page 20
  1457.  
  1458.     
  1459.     Name                  dayofyear - calculate the day of the year
  1460.     
  1461.     Usage                int dayofyear(struct ddate *d);
  1462.     
  1463.     Prototype in         datehk.h
  1464.     
  1465.     Description          dayofyear calculate the day of the year given a
  1466.                          date. The day of the year will range from 1
  1467.                          (January 1) to 365 (Dec 31, no leap year) or 366
  1468.                          (Dec 31, leap year.)
  1469.     
  1470.                          dayofyear does no error checking on passed
  1471.                          parameters.
  1472.     
  1473.     Return value         returns a number from 1 to 365 (no leap year) or
  1474.                          366 (leap year.)
  1475.     
  1476.     See also             daysleft(), diffddate()
  1477.     
  1478.     Example              #include <datehk.h>
  1479.     
  1480.                          main()
  1481.                          {
  1482.                               struct ddate today;
  1483.     
  1484.                               /* set today to Feb 3, 1987 */
  1485.                               printf("%d/%d = day %d\n", today.dmon,
  1486.                                    today.dday, dayofyear(&today));
  1487.                          }
  1488.     
  1489.     Program output       2/3 = day 34
  1490.     
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                                                               Page 21
  1523.  
  1524.     
  1525.     Name                  daysleft - calculate the days left in the year
  1526.     
  1527.     Usage                int daysleft(struct ddate *d);
  1528.     
  1529.     Prototype in         datehk.h
  1530.     
  1531.     Description          daysleft calculates how many more days are left in
  1532.                          the year. The days left will range from 0 (Dec 31)
  1533.                          to 364 (Jan 1, no leap year) or 365 (Jan 1, leap
  1534.                          year.)
  1535.     
  1536.                          daysleft does no error checking on passed
  1537.                          parameters.
  1538.     
  1539.     Return value         returns a number from 0 to 364 (no leap year) or
  1540.                          365 (leap year.)
  1541.     
  1542.     See also             dayofyear(), diffddate()
  1543.     
  1544.     Example              #include <datehk.h>
  1545.     
  1546.                          main()
  1547.                          {
  1548.                               struct ddate today;
  1549.     
  1550.                               /* set today to Nov 3, 1987 */
  1551.                               printf("%d/%d = %d days left\n", today.dmon,
  1552.                                    today.dday, daysleft(&today));
  1553.                          }
  1554.     
  1555.     Program output       11/3 = 58 days left
  1556.     
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                                               Page 22
  1589.  
  1590.     
  1591.     Name                  ddatetolong - convert a date to long string
  1592.     
  1593.     Usage                char *ddatetolong(struct ddate *source); 
  1594.     
  1595.     Prototype in         datehk.h
  1596.     
  1597.     Description          ddatetolong converts a date from the structure
  1598.                          format ddate to a string in the form
  1599.                               Month dd, Year  where
  1600.     
  1601.                               Month = the name of the month ("November")
  1602.                               dd    = the day (5, 12, etc.)
  1603.                               Year  = the year + 1900
  1604.     
  1605.     Return value         returns a pointer to the storage location
  1606.                          containing the date in string format, or NULL if
  1607.                          space could not be allocated.
  1608.     
  1609.     See also             ddatetoshort(), ddatetostr(), monthexpand(),
  1610.                          strtoddate()
  1611.     
  1612.     Example              #include <datehk.h>
  1613.     
  1614.                          main()
  1615.                          {
  1616.                               struct ddate today;
  1617.                               char *strtoday;
  1618.     
  1619.                          /* assign some value to today */
  1620.                               strtoday = ddatetolong(&today);
  1621.                               printf("today is %d-%d-%d\n", today.dmon,
  1622.                                    today.dday, today.dyear);
  1623.                               printf("or %s\n", (strtoday==NULL) ?
  1624.                                    "no memory" : strtoday);
  1625.                          }
  1626.     
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                                                               Page 23
  1655.  
  1656.     
  1657.     Name                  ddatetoshort - convert a date to short string
  1658.     
  1659.     Usage                char *ddatetoshort(struct ddate *source); 
  1660.     
  1661.     Prototype in         datehk.h
  1662.     
  1663.     Description          ddatetoshort converts a date from the structure
  1664.                          format ddate to a string in the form
  1665.                               Mon dd, Year  where
  1666.     
  1667.                               Mon  = the abbreviation of the month ("Nov")
  1668.                               dd   = the day (5, 12, etc.)
  1669.                               Year = the year + 1900
  1670.     
  1671.     Return value         returns a pointer to the storage location
  1672.                          containing the date in string format, or NULL if
  1673.                          space could not be allocated.
  1674.     
  1675.     See also             ddatetolong(), ddatetostr(), monthexpand(),
  1676.                          strtoddate()
  1677.     
  1678.     Example              #include <datehk.h>
  1679.     
  1680.                          main()
  1681.                          {
  1682.                               struct ddate today;
  1683.                               char *strtoday;
  1684.     
  1685.                          /* assign some value to today */
  1686.                               strtoday = ddatetoshort(&today);
  1687.                               printf("today is %d-%d-%d\n", today.dmon,
  1688.                                    today.dday, today.dyear);
  1689.                               printf("or %s\n", (strtoday==NULL) ?
  1690.                                    "no memory" : strtoday);
  1691.                          }
  1692.     
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                                                               Page 24
  1721.  
  1722.     
  1723.     Name                  ddatetostr - convert a date to abbrev. string
  1724.     
  1725.     Usage                char *ddatetostr(struct ddate *source);
  1726.     
  1727.     Prototype in         datehk.h
  1728.     
  1729.     Description          ddatetostr converts a date from the structure
  1730.                          format ddate to a string in the form mm-dd-y..y
  1731.                          where the month and day are always 2 digits long
  1732.                          (a 0 is prefix to single digit months and days)
  1733.                          and year is not altered.
  1734.     
  1735.     Return value         returns a pointer to the storage location
  1736.                          containing the date in string format, or NULL if
  1737.                          space could not be allocated.
  1738.     
  1739.     See also             ddatetolong(), ddatetoshort(), monthexpand(),
  1740.                          strtoddate()
  1741.     
  1742.     Example              #include <datehk.h>
  1743.     
  1744.                          main()
  1745.                          {
  1746.                               struct ddate today;
  1747.                               char *strtoday;
  1748.     
  1749.                          /* assign some value to today */
  1750.                               strtoday = ddatetostr(&today);
  1751.                               printf("today is %d-%d-%d\n", today.dmon,
  1752.                                    today.dday, today.dyear);
  1753.                               printf("or %s\n", (strtoday==NULL) ?
  1754.                                    "no memory" : strtoday);
  1755.                          }
  1756.     
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                                                               Page 25
  1787.  
  1788.     
  1789.     Name                  delay - wait for a time delay
  1790.     
  1791.     Usage                void delay(int wait);
  1792.     
  1793.     Prototype in         timehk.h
  1794.     
  1795.     Description          delay is an empty loop based on the clock that
  1796.                          waits for wait/10 seconds.
  1797.     
  1798.                          wait can be any positive int value (the maximium
  1799.                          wait 32767 is a little less than an hour.) If wait
  1800.                          is negative, erratic behavior may result (it won't
  1801.                          work.)
  1802.     
  1803.     Return value         nothing.
  1804.     
  1805.     Example              #include <timehk.h>
  1806.     
  1807.                          main()
  1808.                          {
  1809.                               delay(5);     /* wait for 1/2 second */
  1810.                               delay(600);   /* wait for one minute */
  1811.     
  1812.     
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                                                               Page 26
  1853.  
  1854.     
  1855.     Name                  DESQfreeCPU - give up CPU time
  1856.     
  1857.     Usage                void DESQfreeCPU(void);
  1858.     
  1859.     Prototype in         multihk.h
  1860.     
  1861.     Description          this function will free the remaining CPU cycles
  1862.                          under DESQview, Topview and Taskview. I have
  1863.                          tested this function only under DESQview, where I
  1864.                          believe it frees the reamining ticks in the
  1865.                          program's turn. If the foreground/background ticks
  1866.                          are set at 6/4, and the program is in the
  1867.                          foreground, it checks something, and if the
  1868.                          program will just sit idle and chew up CPU time,
  1869.                          calling this function frees whatever remain of its
  1870.                          6 ticks.
  1871.     
  1872.     Return value         nothing.
  1873.     
  1874.     See also             DESQversion()
  1875.     
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                                                               Page 27
  1919.  
  1920.     
  1921.     Name                  DESQversion - DESQview/Topview/Taskview version
  1922.     
  1923.     Usage                int DESQversion(void);
  1924.     
  1925.     Prototype in         multihk.h
  1926.     
  1927.     Description          determines if DESQview/Topview/Taskview is running
  1928.                          and gets the version number
  1929.     
  1930.     Return value         returns zero if DESQview, Topview or Taskview is
  1931.                          not running, otherwise returns the version number.
  1932.     
  1933.     Note                 I have only been able to test this under DESQview.
  1934.                          Running under DOS, this function returns zero.
  1935.                          While running under DESQview, DESQversion returns
  1936.                          0xA01, regardless of which version I tried it
  1937.                          under (2.0 or 2.01.) If anyone can offer some
  1938.                          information, I'd appreciate it. For now, assume a
  1939.                          return value of zero means DESQview/Topview/Task-
  1940.                          view is not active, a nonzero return means one of
  1941.                          them is active.
  1942.     
  1943.     See also             DESQfreeCPU()
  1944.     
  1945.     Example              #include <multihk.h>
  1946.     
  1947.                          main()
  1948.                          {
  1949.                               printf("DESQview/Topview/Taskview is ");
  1950.                               if (! isDESQversion())
  1951.                                    printf("not ");
  1952.                               printf("running\n");
  1953.                          }
  1954.     
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                                                               Page 28
  1985.  
  1986.     
  1987.     Name                  diffddate - calculate the difference in 2 dates
  1988.     
  1989.     Usage                long int diffddate(struct ddate *start,
  1990.                                              struct ddate *fini);
  1991.     
  1992.     Prototype in         datehk.h
  1993.     
  1994.     Description          diffdate calculates the difference in days between
  1995.                          start and fini (fini - start).
  1996.     
  1997.                          diffdate does not perform any error checking on
  1998.                          the passed parameters.
  1999.     
  2000.     Return value         returns the number of days from start to fini.
  2001.     
  2002.     See also             dayofyear(), daysleft(), diffddate()
  2003.     
  2004.     Example              #include <datehk.h>
  2005.     
  2006.                          main()
  2007.                          {
  2008.                               struct ddate begin, end;
  2009.                               long int days;
  2010.     
  2011.                               /* set begin to Jan 1, 1981 */
  2012.                               /* set end to Feb 5, 1982 */
  2013.                               days = diffdate(&begin,&end);
  2014.                               printf("Feb 5, 1982 - Jan 1, 1981 =
  2015.                                    %ld\n",days);
  2016.                          }
  2017.     
  2018.     Program output       Feb 5, 1982 - Jan 1, 1981 = 400
  2019.     
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                                                               Page 29
  2051.  
  2052.     
  2053.     Name                  disktype - disk drive type
  2054.     
  2055.     Usage                byte disktype(byte drive);
  2056.     
  2057.     Prototype in         ibm.h
  2058.     
  2059.     Description          disktype will determine the type of disk drive
  2060.                          being tested. drive specifies the drive to check.
  2061.                          Set drive to zero to specify the default drive,
  2062.                          one is A:, two is B:, etc.
  2063.     
  2064.     Return value         returns the drive id byte. See ibm.h for more
  2065.                          details.
  2066.     
  2067.     Example              see testdisk.c
  2068.     
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                                                               Page 30
  2117.  
  2118.     
  2119.     Name                  DoubleDOSfreeCPU - give up CPU time under
  2120.                                             Double DOS
  2121.     
  2122.     Usage                void DoubleDOSfreeCPU(byte slices);
  2123.     
  2124.     Prototype in         multihk.h
  2125.     
  2126.     Description          this function frees up CPU time from the current
  2127.                          program. The amount of time freed up is found by
  2128.                          slices * 55ms.
  2129.     
  2130.     Return value         nothing.
  2131.     
  2132.     See also             DoubleDOSTaskSwitch(), isDoubleDOS()
  2133.     
  2134.     Example              #include <multihk.h>
  2135.     
  2136.                          main()
  2137.                          {
  2138.                               DoubleDOSfreeCPU(1000); /* frees 55 secs */
  2139.                          }
  2140.     
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                                                               Page 31
  2183.  
  2184.     
  2185.     Name                  DoubleDOSTaskSwitch - set Double DOS task
  2186.                                                  switching on/off
  2187.     
  2188.     Usage                void DoubleDOSTaskSwitch(boolean on);
  2189.     
  2190.     Prototype in         multihk.h
  2191.     
  2192.     Description          sets Double DOS task switching on or off.
  2193.     
  2194.     Return value         nothing.
  2195.     
  2196.     See also             DoubleDOSfreeCPU(), isDoubleDOS()
  2197.     
  2198.     Example              #include <multihk.h>
  2199.     
  2200.                          #define ENABLE     TRUE
  2201.     
  2202.                          main()
  2203.                          {
  2204.                               DoubleDOSTaskSwitch(ENABLE);
  2205.                          }
  2206.     
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                                                               Page 32
  2249.  
  2250.     
  2251.     Name                  EMMversion - version of Expanded Memory Manager
  2252.     
  2253.     Usage                boolean EMMversion(byte *version);
  2254.     
  2255.     Prototype in         ibm.h
  2256.     
  2257.     Description          finds the version of 
  2258.     
  2259.     Return value         returns TRUE if successful (and *version is the
  2260.                          version id,) FALSE if an error occurred (and
  2261.                          *version is the error code.)
  2262.     
  2263.     Note                 this function is available under EMM 3.2 specs.
  2264.     
  2265.     See also             ibm.h
  2266.                          isEMSavail()
  2267.     
  2268.     Example              #include <ibm.h>
  2269.     
  2270.                          main()
  2271.                          {
  2272.                               byte *ver;
  2273.     
  2274.                               if (isEMSavail())
  2275.                                    if (EMMversion(ver))    /* success */
  2276.                                         printf("EMM version id %X\n",*ver);
  2277.                                    else                    /* error */
  2278.                                         printf("EMM error code %X\n",*ver);
  2279.                          }
  2280.     
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.                                                               Page 33
  2315.  
  2316.     
  2317.     Name                  Extendedtotal - total Extended memory installed
  2318.     
  2319.     Usage                int Extendedtotal(void);
  2320.     
  2321.     Prototype in         ibm.h
  2322.     
  2323.     Description          detects the total amount of Extended memory
  2324.                          installed.
  2325.     
  2326.     Return value         returns the total Extended memory installed, in
  2327.                          Kbytes.
  2328.     
  2329.     Note                 you should check for the presence of Extended
  2330.                          memory with isExtended() before using this
  2331.                          function. Calling Extendedtotal() when no Extended
  2332.                          memory is present can lead to unpredictable
  2333.                          results.
  2334.     
  2335.     See also             isEMSavail(), isExtended()
  2336.     
  2337.     Example              #include <ibm.h>
  2338.     
  2339.                          main()
  2340.                          {
  2341.                               printf("Total Extended Memory is %dK\n",
  2342.                                    Extendedtotal());
  2343.                          }
  2344.     
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.                                                               Page 34
  2381.  
  2382.     
  2383.     Name                  fulltoddate - convert a full date to struct
  2384.                           shorttoddate - convert a short date to struct
  2385.     
  2386.     Usage                struct ddate *fulltoddate(char *source);
  2387.                          struct ddate *shorttoddate(char *source);
  2388.     
  2389.     Prototype in         datehk.h
  2390.     
  2391.     Description          fulltoddate converts a date from a full date
  2392.                          format to the structure ddate format
  2393.     
  2394.                          shorttoddate converts a date from a short date
  2395.                          format to the structure ddate format
  2396.     
  2397.     Return value         returns a pointer to the storage location
  2398.                          containing the date structure, or NULL if space
  2399.                          could not be allocated.
  2400.     
  2401.     See also             see Appendix A
  2402.                          Cal...(), Greg...(), Jul...()
  2403.     
  2404.     Example              see demodate.c
  2405.     
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.                                                               Page 35
  2447.  
  2448.     
  2449.     Name                  getc_match - get specific input,  case
  2450.                          independent
  2451.                           getk_match - get specific input, case dependent
  2452.     
  2453.     Usage                char getc_match(boolean output, char *match);
  2454.                          char getk_match(boolean output, char *match);
  2455.     
  2456.     Prototype in         keyboard.h
  2457.     
  2458.     Description          these functions accept character input (via
  2459.                          getk()) until one of the characters in the string
  2460.                          match in entered. getk_match waits for an
  2461.                          identical match ('a' != 'A') and getc_match waits
  2462.                          for a similar match ('a' == 'A'). Extended keys
  2463.                          never match (F10 will never be a match.) If output
  2464.                          = TRUE, the character is echoed to the screen via
  2465.                          putk().
  2466.     
  2467.     Return value         returns the key pressed.
  2468.     
  2469.     See also             getk(), getlogical(), getyn()
  2470.     
  2471.     Example              #include <keyboard.h>
  2472.     
  2473.                          main()
  2474.                          {
  2475.                               printf("Enter your choice (Q, X, F, D): ");
  2476.                               getc_match(1,"QXFD");
  2477.                               printf("Enter your sub-choice (abcdHJ): ");
  2478.                               getk_match(1,"abcdHJ");
  2479.                          }
  2480.     
  2481.     Program output       Enter your choice (Q, X, F, D): f
  2482.                          Enter your subchoice (abcdHJ): H
  2483.     
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.                                                               Page 36
  2513.  
  2514.     
  2515.     Name                  getddate - inputs a date from the keyboard
  2516.     
  2517.     Usage                char *getddate(void);
  2518.     
  2519.     Prototype in         keyboard.h
  2520.     
  2521.     Description          getddate inputs a date from the keyboard in the
  2522.                          form xx-xx-xx. Only digits, space and backspace
  2523.                          are valid input. Input is terminated when the
  2524.                          ENTER key is pressed. Input is echoed to the
  2525.                          screen via putk().
  2526.     
  2527.     Return value         if a valid date is entered, getddate returns a
  2528.                          string in the form xx-xx-xx, otherwise NULL is
  2529.                          returned.
  2530.     
  2531.     Example              #include <keyboard.h>
  2532.                          #include <stdio.h>
  2533.                          main()
  2534.                          {
  2535.                               char *c;
  2536.     
  2537.                               printf("What is today's date: ");
  2538.                               c = getddate();
  2539.                               printf("Today is %s\n",c);
  2540.                          }
  2541.     
  2542.     Program output       What is today's date: 11-10-87
  2543.                          Today is 11-10-87
  2544.     
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.                                                               Page 37
  2579.  
  2580.     
  2581.     Name                  getdouble - inputs a double from the keyboard
  2582.     
  2583.     Usage                char *getdouble(void);
  2584.     
  2585.     Prototype in         keyboard.h
  2586.     
  2587.     Description          getdouble inputs a double from the keyboard. Only
  2588.                          digits, decimal point, leading sign and backspace
  2589.                          are valid input. Input is terminated when the
  2590.                          ENTER key is pressed. Input is echoed to the
  2591.                          screen via putk().
  2592.     
  2593.                          The maximum length of input is 25.
  2594.     
  2595.     Return value         returns a string of the format    [sn] [ddd] [.]
  2596.                          [ddd] where
  2597.     
  2598.                               [sn]  = optional sign (+ or -)
  2599.                               [ddd] = optional digits
  2600.                               [.]   = optional decimal point
  2601.     
  2602.     See also             getint(), getreal()
  2603.     
  2604.     Example              #include <keyboard.h>
  2605.                          #include <stdio.h>
  2606.                          main()
  2607.                          {
  2608.                               char *c;
  2609.     
  2610.                               printf("Give me a double: ");
  2611.                               c = getdouble();
  2612.                               printf("Your input is %s\n",c);
  2613.                          }
  2614.     
  2615.     Program output       Give me a double: -1289.12003
  2616.                          Your input is -1289.12003
  2617.     
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.                                                               Page 38
  2645.  
  2646.     
  2647.     Name                  getfname - get a filename from the keyboard
  2648.     
  2649.     Usage                int getfname(byte row, byte col, char *returnstr,
  2650.                                    char *pattern, int argn, int argk[]);
  2651.     
  2652.     Prototype in         video.h
  2653.     
  2654.     Description          getfname calls getget() asking for input of a
  2655.                          length 12 string, at the coordinates (col,row),
  2656.                          including pattern formatting and optional input
  2657.                          exit keys listed in argk. If memory was allocated
  2658.                          for returnstr, the string pointed to by returnstr
  2659.                          is checked to see if it is a valid DOS filename. A
  2660.                          valid filename must be of the form
  2661.                              [filename] [.] [ext]    and does not contain
  2662.                          any of the following:
  2663.     
  2664.                               [ ] ; , . / ? * : " + = - < > \ |
  2665.     
  2666.                          If memory could not be allocated for the string,
  2667.                          returnstr will be set to NULL.
  2668.     
  2669.                          For more info on pattern and argk requirements,
  2670.                          check the stats for getget().
  2671.     
  2672.     Return value         if memory could not be allocated for returnstr or
  2673.                          the string pointed to by returnstr is not a valid
  2674.                          filename, -1 is returned, otherwise the key used
  2675.                          to exit the input is returned.
  2676.     
  2677.     See also             getget()
  2678.     
  2679.     Example              #include <filehk.h>
  2680.                          #include <keycode.h>
  2681.     
  2682.                          main()
  2683.                          {
  2684.                               char *fname;
  2685.                               int keys[2]={ESC,F10};  /* ESC & F10 exit
  2686.                               input */
  2687.     
  2688.                               gotoxy(0,0);
  2689.                               printf("Enter file: ");
  2690.                               if (getfname(0,13,fname,"!",2,keys) == -1)
  2691.                                    printf("    BAD FILENAME");
  2692.                               else
  2693.                                    printf("    valid filename");
  2694.                          }
  2695.     
  2696.     Program output       
  2697.     
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.                                                               Page 39
  2711.  
  2712.     
  2713.     Name                  getget - get a string from the keyboard
  2714.                          w/editing
  2715.     
  2716.     Usage                int getget(byte row, byte col, char *returnstr,
  2717.                                         int size, char *pattern, int argn,
  2718.                                         int argk[]);
  2719.     
  2720.     Prototype in         keyboard.h
  2721.     
  2722.     Description          getget inputs a string at coordinates (col,row),
  2723.                          of maximum length size, formatted according to
  2724.                          pattern. Input ends when ENTER or one of the scan
  2725.                          codes specified in argk[] in inputted. There are
  2726.                          argn number of elements in argk[]. The string is
  2727.                          returned in returnstr and the function returns the
  2728.                          scan code of the exiting key.
  2729.     
  2730.                          Full feature editing of the string includes:
  2731.     
  2732.                              ENTER           Ends input, exits function
  2733.                              BACKSPACE       normal backspace
  2734.                              LEFT ARROW      move cursor back 1 character
  2735.                              INSERT          toggle inset/overwrite mode
  2736.                              DELETE          delete character under cursor
  2737.                              RIGHT ARROW     move cursor forward 1
  2738.                                              character
  2739.                              HOME            move cursor to beginning for
  2740.                                              string
  2741.                              END             move cursor to end of string
  2742.                              CTRL-Y          delete entire string
  2743.                              ALT-Y           delete string from cursor to
  2744.                                              end
  2745.     
  2746.                          See getstr() for pattern arguments.
  2747.     
  2748.     Return value         returns the scan code of the key causing the exit
  2749.     
  2750.     See also             getstr()
  2751.     
  2752.     
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.                                                               Page 40
  2777.  
  2778.     
  2779.     Name                  getint - inputs an integer from the keyboard
  2780.     
  2781.     Usage                char *getint(void);
  2782.     
  2783.     Prototype in         keyboard.h
  2784.     
  2785.     Description          getint inputs an integer from the keyboard. Only
  2786.                          digits, leading sign and backspace are valid
  2787.                          input. Input is terminated when the ENTER key is
  2788.                          pressed. Input is echoed to the screen via putk().
  2789.     
  2790.                         the maximum length of input is 25.
  2791.     
  2792.     Return value         returns a string of the format  [sn] [ddd]  where
  2793.     
  2794.                               [sn]  = optional sign (+ or -)
  2795.                               [ddd] = optional digits
  2796.     
  2797.     See also             getdouble(), getreal()
  2798.     
  2799.     Example              #include <keyboard.h>
  2800.                          #include <stdio.h>
  2801.                          main()
  2802.                          {
  2803.                               char *c;
  2804.     
  2805.                               printf("Give me an integer: ");
  2806.                               c = getint();
  2807.                               printf("Your input is %s\n",c);
  2808.                          }
  2809.     
  2810.     Program output       Give me an integer: -1289
  2811.                          Your input is -1289
  2812.     
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.                                                               Page 41
  2843.  
  2844.     
  2845.     Name                  getk - get a key
  2846.     
  2847.     Usage                byte getk(boolean wait);
  2848.     
  2849.     Prototype in         keyboard.h
  2850.     
  2851.     Description          getk returns the scan code of the key pressed. If
  2852.                          no key was pressed (WAIT = FALSE) 0 is returned.
  2853.                          This function is similar to getchar() except input
  2854.                          is not echoed to the screen and getk will detect
  2855.                          any key press (any standard keypress. It cannot
  2856.                          distinguish between the grey '+' key and the white
  2857.                          '+'. This function is interrupt driven. It will
  2858.                          detect ALT combinations, Del, PgUp, function keys,
  2859.                          etc., any keyboard INTerrupt accepted keys.
  2860.     
  2861.     Return value         returns the scancode for the key pressed, from 1
  2862.                          to 255. If WAIT = FALSE, and no key is pressed,
  2863.                          zero is returned. Check the global variables
  2864.                          key_status and key_extended to determine the shift
  2865.                          key status and if the key is an extended one.
  2866.     
  2867.     See also             keycode.h
  2868.                          getc_match(), getk_match(), getlogical(), getyn(),
  2869.                          inkey()
  2870.     
  2871.     Example              #include <keyboard.h>
  2872.                          #include <stdio.h>
  2873.     
  2874.                          main()
  2875.                          {
  2876.                               extern boolean key_extended;
  2877.                               byte c;
  2878.     
  2879.                               c = getk(WAIT);
  2880.                               printf("Key code # in keycode.h: %d\n",
  2881.                                    key_extended ? c+256 : c);
  2882.                          }
  2883.     
  2884.     
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.                                                               Page 42
  2909.  
  2910.     
  2911.     Name                  getlogical - get Yes/No
  2912.     
  2913.     Usage                char getlogical(int output);
  2914.     
  2915.     Prototype in         keyboard.h
  2916.     
  2917.     Description          getlogical waits for a True/False key (TtFfYyNn)
  2918.                          to be pressed and then displays a message via
  2919.                          putstr() according to output:
  2920.     
  2921.                               output         Message displayed
  2922.                               ------         -----------------
  2923.                                 0               no message
  2924.                                 1                T or F or Y or N
  2925.                                 2                True or False or Yes or No
  2926.     
  2927.                          getlogical is case independent.
  2928.     
  2929.     Return value         returns 'Y' or 'N'
  2930.     
  2931.     See also             getc_match(), getk(), getk_match(), getyn(),
  2932.                          inkey()
  2933.     
  2934.     Example              #include <keyboard.h>
  2935.     
  2936.                          main()
  2937.                          {
  2938.                               printf("This is good? ");
  2939.                               getlogical(2);
  2940.                          }
  2941.     
  2942.     
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.                                                               Page 43
  2975.  
  2976.     
  2977.     Name                  getreal - inputs a real from the keyboard
  2978.     
  2979.     Usage                char *getreal(int size, int decimal);
  2980.     
  2981.     Prototype in         keyboard.h
  2982.     
  2983.     Description          getreal inputs a real (double) from the keyboard.
  2984.                          Only digits, decimal place, leading sign and
  2985.                          backspace are valid input. Input is terminated
  2986.                          when the ENTER key is pressed. Input is echoed to
  2987.                          the screen via putk().
  2988.     
  2989.                          the maximum length of input is size and the
  2990.                          maximum number of decimal places is decimal. When
  2991.                          calculating size, you must leave enough room for
  2992.                          decimal, plus the number of places of the leading
  2993.                          integer, one for the decimal point and one for the
  2994.                          leading sign.
  2995.     
  2996.     Return value         returns a string of the format  [sn] [ddd] [.]
  2997.                          [ddd] where
  2998.     
  2999.                               [sn]  = optional sign (+ or -)
  3000.                               [ddd] = optional digits
  3001.                               [.]   = optional decimal point
  3002.     
  3003.     See also             getdouble(), getint()
  3004.     
  3005.     Example              #include <keyboard.h>
  3006.                          #include <stdio.h>
  3007.                          main()
  3008.                          {
  3009.                               char *c;
  3010.     
  3011.                               printf("Give me a real: ");
  3012.                               c = getreal(8,2);
  3013.                               printf("Your input is %s\n",c);
  3014.                          }
  3015.     
  3016.     Program output       Give me a real: -1012.30
  3017.                          Your input is -1012.30
  3018.     
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.                                                               Page 44
  3041.  
  3042.     
  3043.     Name                  getstr - input a string from the keyboard
  3044.     
  3045.     Usage                char *getstr(int size, char *pattern);
  3046.     
  3047.     Prototype in         keyboard.h
  3048.     
  3049.     Description          getstr inputs a string from the keyboard, of
  3050.                          maximum length size, given a format pattern where
  3051.     
  3052.                                     pattern       format
  3053.                                     -------       ------
  3054.                          Types          a         Alphabetic
  3055.                                         A         Alphabetic and
  3056.                                                   capitalized
  3057.                                         n         Alphanumeric
  3058.                                         N         Alphanumeric and
  3059.                                                   capitalized
  3060.                                         X         Ascii (default)
  3061.                                         9         Numeric
  3062.                                         #         Numeric and punctuation
  3063.     
  3064.                          Modifiers      !         convert to upper case
  3065.                                         .         punctuation
  3066.                                         (         left justify
  3067.                                         )         right justify
  3068.                                         ^         center justify
  3069.     
  3070.                          The only other valid keys are backspace and ENTER.
  3071.                          Input is echoed to the screen via putk().
  3072.     
  3073.     Return value         returns a pointer to the storage location
  3074.                          containing the formatted string, or NULL if space
  3075.                          could not be allocated.
  3076.     
  3077.     See also             getget()
  3078.     
  3079.     Example              #include <keyboard.h>
  3080.                          #include <stdio.h>
  3081.     
  3082.                          main()
  3083.                          {
  3084.                               char *f, *l, *s, *c;
  3085.     
  3086.                               printf("First name: ");
  3087.                               f = getget(10,"A");
  3088.                               printf("Last name: ");
  3089.                               l = getget(20,"a");
  3090.                               printf("SS#: ");
  3091.                               s = getget(8,"9");
  3092.                               printf("Comments: ");
  3093.                               c = getget(60,"");
  3094.                          }
  3095.     
  3096.     
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.                                                               Page 45
  3107.  
  3108.     Program output       First name: HOWARD
  3109.                          Last name: kapustein
  3110.                          SS#: 123456789
  3111.                          Comments: The empty quotes defaults to X.
  3112.     
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.                                                               Page 46
  3173.  
  3174.     
  3175.     Name                  getyn - get Yes/No
  3176.     
  3177.     Usage                char getyn(int output);
  3178.     
  3179.     Prototype in         keyboard.h
  3180.     
  3181.     Description          getyn waits for a Y or N to be pressed and then
  3182.                          displays a message via putstr() according to
  3183.                          output:
  3184.     
  3185.                               output         Message displayed
  3186.                               ------         -----------------
  3187.                                 0               no message
  3188.                                 1                Y or N
  3189.                                 2                Yes or No
  3190.     
  3191.                          getyn is case independent.
  3192.     
  3193.     Return value         returns 'Y' or 'N'
  3194.     
  3195.     See also             getc_match(), getk(), getk_match(), getlogical(),
  3196.                          inkey()
  3197.     
  3198.     Example              #include <keyboard.h>
  3199.     
  3200.                          main()
  3201.                          {
  3202.                               printf("Is this OK? ");
  3203.                               getyn(2);
  3204.                          }
  3205.     
  3206.     
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.                                                               Page 47
  3239.  
  3240.     
  3241.     Name                  gotoxy - move cursor to coordinates (x,y)
  3242.     
  3243.     Usage                void gotoxy(int x, int y);
  3244.     
  3245.     Prototype in         video.h
  3246.     
  3247.     Description          gotoxy puts cursor at coordinates (x,y) via INT
  3248.                          0x10, Service 2.
  3249.     
  3250.     Return value         nothing.
  3251.     
  3252.     See also             read_cursor(), wherex(), wherey()
  3253.     
  3254.     Example              #include <video.h>
  3255.     
  3256.                          main()
  3257.                          {
  3258.                               gotoxy(4,10);   /* put cursor at row 4,
  3259.                               column 10 */
  3260.                          }
  3261.     
  3262.     
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.                                                               Page 48
  3305.  
  3306.     
  3307.     Name                  Greg... - family of Gregorian date conversion
  3308.                                    functions
  3309.     
  3310.     Usage                double GregtoCal(char *greg);
  3311.                          double GregtoCalCent(char *greg);
  3312.     
  3313.                          double GregEurotoCal(char *greg);
  3314.                          double GregEurotoCalCent(char *greg);
  3315.     
  3316.                          double GregJaptoCal(char *greg);
  3317.                          double GregJaptoCalCent(char *greg);
  3318.     
  3319.     Prototype in         datehk.h
  3320.     
  3321.     Description          GregtoCal           converts Gregorian (US) dates
  3322.                                              to Calendar dates
  3323.                          GregtoCalCent       converts Gregorian (US) dates
  3324.                                              to Calendar dates (w/century)
  3325.     
  3326.                          GregEurotoCal       converts Gregorian (European)
  3327.                                              dates to Calendar dates
  3328.                          GregEurotoCalCent   converts Gregorian (European)
  3329.                                              dates to Calendar dates
  3330.                                              (w/century)
  3331.     
  3332.                          GregJaptoCal        converts Gregorian (Japan)
  3333.                                              dates to Calendar dates
  3334.                          GregJaptoCalCent    converts Gregorian (Japan)
  3335.                                              dates to Calendar dates
  3336.                                              (w/century)
  3337.     
  3338.     Return value         GregtoCal, GregEurotoCal, GregJaptoCal return a
  3339.                               Calendar date
  3340.                          GregtoCalCent, GregEurotoCalCent, GregJaptoCalCent
  3341.                               return a Calendar date (w/century)
  3342.     
  3343.     See also             Appendix A
  3344.                          Cal...(), fulltoddate(), Jul...(), shorttoddate()
  3345.     
  3346.     Example              see demodate.c
  3347.     
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.                                                               Page 49
  3371.  
  3372.     
  3373.     Name                  horiz_line - draw a horizontal line
  3374.     
  3375.     Usage                void horiz_line(byte c, unsigned int len, byte
  3376.                          row,
  3377.                                         byte col);
  3378.     
  3379.     Prototype in         video.h
  3380.     
  3381.     Description          draws a horizontal line of characters c of length
  3382.                          len beginning at (col,row) via INTerrupts.
  3383.     
  3384.                          horiz_line does no error checking on the passed
  3385.                          parameters.
  3386.     
  3387.     Return value         nothing.
  3388.     
  3389.     See also             box(), restore_box(), restore_screen(),
  3390.                          save_box(), save_screen(), vert_line()
  3391.     
  3392.     Example              #include <video.h>
  3393.     
  3394.                          main()
  3395.                          {
  3396.                               horiz_line('*',7,4,4);  /* draw 7 *'s at
  3397.                               (4,4) */
  3398.                          }
  3399.     
  3400.     
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.                                                               Page 50
  3437.  
  3438.     
  3439.     Name                  inkey - get a key
  3440.     
  3441.     Usage                int inkey(boolean wait);
  3442.     
  3443.     Prototype in         keyboard.h
  3444.     
  3445.     Description          inkey returns the scan code of the key pressed. If
  3446.                          no key was pressed (WAIT = FALSE) 0 is returned.
  3447.                          This function is similar to getchar() except input
  3448.                          is not echoed to the screen and getk will detect
  3449.                          any key press (any standard keypress. It cannot
  3450.                          distinguish between the grey '+' key and the white
  3451.                          '+'. This function is interrupt driven. It will
  3452.                          detect ALT combinations, Del, PgUp, function keys,
  3453.                          etc., any keyboard INTerrupt accepted keys.
  3454.     
  3455.     Return value         returns the scancode for the key pressed, from 1
  3456.                          to 511. If WAIT = FALSE, and no key is pressed,
  3457.                          zero is returned.
  3458.     
  3459.     See also             keycode.h
  3460.                          getc_match(), getk(), getk_match(), getlogical(),
  3461.                          getyn()
  3462.     
  3463.     Example              #include <keyboard.h>
  3464.                          #include <stdio.h>
  3465.     
  3466.                          main()
  3467.                          {
  3468.                               int c;
  3469.     
  3470.                               c = inkey(WAIT);
  3471.                               printf("Key code # in keycode.h: %d\n", c);
  3472.                          }
  3473.     
  3474.     
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.                                                               Page 51
  3503.  
  3504.     
  3505.     Name                  intlen - calculate length of integer in a string
  3506.     
  3507.     Usage                int intlen(char *number);
  3508.     
  3509.     Prototype in         stringhk.h
  3510.     
  3511.     Description          intlen calculates the length of an integer in the
  3512.                          string number. The integer is terminated by a
  3513.                          non-digit (any character other than 0-9.) This
  3514.                          function is used internally by strcomma.
  3515.     
  3516.     Return value         the length of the integer pointed to by number.
  3517.     
  3518.     Example              #include <stringhk.h>
  3519.                          #include <stdio.h>           /* for the printf */
  3520.                          #include <alloc.h>           /* for the calloc */
  3521.     
  3522.                          main()
  3523.                          {
  3524.                               char *sint[15];
  3525.                               int len;
  3526.     
  3527.                               strcpy(sint,"1839.44");
  3528.                               printf("String: %s    Length of integer:
  3529.                               %d\n", sint, intlen(sint));
  3530.                               strcpy(sint,"19,848");
  3531.                               printf("String: %s    Length of integer:
  3532.                               %d\n", sint, intlen(sint));
  3533.                               strcpy(sint,"44x993");
  3534.                               printf("String: %s    Length of integer:
  3535.                               %d\n", sint, intlen(sint));
  3536.                          }
  3537.     
  3538.     Program output       String: 1839.44    Length of integer: 4
  3539.                          String: 19,848    Length of integer: 2
  3540.                          String: 44x993    Length of integer: 2
  3541.     
  3542.     
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.                                                               Page 52
  3569.  
  3570.     
  3571.     Name                  isBREAKon - check Ctrl-BREAK flag
  3572.     
  3573.     Usage                boolean isBREAKon(void);
  3574.     
  3575.     Prototype in         ibm.h
  3576.     
  3577.     Description          checks the state of the Ctrl-BREAK flag. The BREAK
  3578.                          status flag can be set from DOS by BREAK ON or
  3579.                          BREAK OFF.
  3580.     
  3581.     Return value         returns TRUE if the break flag is on, FALSE if the
  3582.                          flag is off.
  3583.     
  3584.     See also             isVERIFYon(), setBREAK(), setVERIFY()
  3585.     
  3586.     Example              #include <ibm.h>
  3587.     
  3588.                          main()
  3589.                          {
  3590.                               printf("BREAK flag is ");
  3591.                               if (! isBREAKon())
  3592.                                    printf("not ");
  3593.                               printf("on\n");
  3594.                          }
  3595.     
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.                                                               Page 53
  3635.  
  3636.     
  3637.     Name                  isCGA - is Color Graphics adapter installed
  3638.                           isEGA - is Enhanced Graphics adapter installed
  3639.                           isHerc - is Hercules Graphics adapter installed
  3640.                           isMDA - is Monochrome adapter installed
  3641.     
  3642.                          ismono - is monochrome display
  3643.                          iscolor - is color display
  3644.     
  3645.     Usage                boolean isMDA(void);
  3646.                          boolean isCGA(void);
  3647.                          boolean isEGA(void);
  3648.                          boolean isHerc(void);
  3649.     
  3650.                          boolean ismono(void);
  3651.                          boolean iscolor(void);
  3652.     
  3653.     Prototype in         video.h
  3654.     
  3655.     Description          is...() check if a video adapter is present.
  3656.                          ismono() checks if the display is mono.
  3657.                          iscolor() checks if the display is color.
  3658.     
  3659.                          The ismono() and iscolor() are combinations. Use
  3660.                          them if you wish to check what attributes to use
  3661.                          (underline or red?) and use the adapter functions
  3662.                          (isEGA, etc.) for adapter specific tests.
  3663.     
  3664.     Return value         these functions return TRUE if the video adapter
  3665.                          or type, as the case may be, is present. Otherwise
  3666.                          they return FALSE.
  3667.     
  3668.     See also             video.h
  3669.     
  3670.     Example              #include <video.h>
  3671.     
  3672.                          main()
  3673.                          {
  3674.                               if (ismono())           /* monochrome */
  3675.                                    if (isHerc())
  3676.                                         printf("Hercules");
  3677.                                    else
  3678.                                         printf("MDA");
  3679.                               else                    /* color */
  3680.                                    if (isEGA())
  3681.                                         printf("EGA");
  3682.                                    else
  3683.                                         printf("CGA");
  3684.                          }
  3685.     
  3686.     
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.                                                               Page 54
  3701.  
  3702.     
  3703.     Name                  isDoubleDOS - is Double DOS active
  3704.     
  3705.     Usage                boolean isDoubleDOS(void);
  3706.     
  3707.     Prototype in         multihk.h
  3708.     
  3709.     Description          checks if Double DOS is active.
  3710.     
  3711.     Return value         returns TRUE if Double DOS is active, FALSE if
  3712.                          Double DOS is not active.
  3713.     
  3714.     See also             DoubleDOSfreeCPU(), DoubleDOSTaskSwitch()
  3715.     
  3716.     Example              #include <multihk.h>
  3717.     
  3718.                          main()
  3719.                          {
  3720.                               printf("Double DOS is ");
  3721.                               if (! isDoubleDOS())
  3722.                                    printf("not ");
  3723.                               printf("active\n");
  3724.                          }
  3725.     
  3726.  
  3727.  
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.                                                               Page 55
  3767.  
  3768.     
  3769.     Name                  isEMSavail - is EMS available
  3770.     
  3771.     Usage                boolean isEMSavail(void);
  3772.     
  3773.     Prototype in         ibm.h
  3774.     
  3775.     Description          checks if an EMS device is installed.
  3776.     
  3777.     Return value         returns TRUE if EMS is present, otherwise FALSE.
  3778.     
  3779.     See also             ibm.h
  3780.                          EMMversion(), isExtended(), Extendedtotal()
  3781.     
  3782.     Example              #include <ibm.h>
  3783.     
  3784.                          main()
  3785.                          {
  3786.                               printf("EMS is ");
  3787.                               if (! isEMSavail())
  3788.                                    printf("not ");
  3789.                               printf("available\n");
  3790.                          }
  3791.     
  3792.     
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.                                                               Page 56
  3833.  
  3834.     
  3835.     Name                  isExtended - is Extended memory installed
  3836.     
  3837.     Usage                boolean isExtended(void);
  3838.     
  3839.     Prototype in         ibm.h
  3840.     
  3841.     Description          checks if Extended memory is installed.
  3842.     
  3843.     Return value         returns TRUE if Extended memory is installed,
  3844.                          FALSE otherwise.
  3845.     
  3846.     See also             isEMSavail(), Extendedtotal()
  3847.     
  3848.     Example              #include <ibm.h>
  3849.     
  3850.                          main()
  3851.                          {
  3852.                               printf("Extended memory is ");
  3853.                               if (! isExtended())
  3854.                                    printf("not ");
  3855.                               printf("installed\n");
  3856.                          }
  3857.     
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.                                                               Page 57
  3899.  
  3900.     
  3901.     Name                  isleapyear - is a year a leap year
  3902.     
  3903.     Usage                boolean isleapyear(int checkyear);
  3904.     
  3905.     Prototype in         datehk.h
  3906.     
  3907.     Description          checks if checkyear is a leap year (29 days in
  3908.                          February.)
  3909.     
  3910.     Return value         returns TRUE if checkyear is a leap year, FALSE
  3911.                          otherwise.
  3912.     
  3913.     See also             valid_date()
  3914.     
  3915.     Example              #include <datehk.h>
  3916.     
  3917.                          main()
  3918.                          {
  3919.                               int year;
  3920.     
  3921.                          /* assign some value to year */
  3922.                               printf("year %d is ",year);
  3923.                               if (! isleapyear(year))
  3924.                                    printf("not ");
  3925.                               printf("a leap year\n");
  3926.                          }
  3927.     
  3928.     
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.                                                               Page 58
  3965.  
  3966.     
  3967.     Name                  isNetwork - is a network installed
  3968.     
  3969.     Usage                boolean isNetwork(void);
  3970.     
  3971.     Prototype in         ibm.h
  3972.     
  3973.     Description          checks if a network is installed.
  3974.     
  3975.     Return value         returns TRUE if a network is installed, FALSE
  3976.                          otherwise.
  3977.     
  3978.     Note                 this function requires DOS 3.1+
  3979.     
  3980.     Example              #include <ibm.h>
  3981.     
  3982.                          main()
  3983.                          {
  3984.                               printf("A network is ");
  3985.                               if (! isNetwork())
  3986.                                    printf("not ");
  3987.                               printf("installed\n");
  3988.                          }
  3989.     
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.                                                               Page 59
  4031.  
  4032.     
  4033.     Name                  isVERIFYon - check VERIFY flag
  4034.     
  4035.     Usage                boolean isVERIFYon(void);
  4036.     
  4037.     Prototype in         ibm.h
  4038.     
  4039.     Description          checks the state of the verify flag. The VERIFY
  4040.                          status flag can be set from DOS by VERIFY ON or
  4041.                          VERIFY OFF.
  4042.     
  4043.     Return value         returns TRUE if the verify flag is on, FALSE if
  4044.                          the flag is off.
  4045.     
  4046.     See also             isBREAKon(), setBREAK(), setVERIFY()
  4047.     
  4048.     Example              #include <ibm.h>
  4049.     
  4050.                          main()
  4051.                          {
  4052.                               printf("VERIFY flag is ");
  4053.                               if (! isVERIFYon())
  4054.                                    printf("not ");
  4055.                               printf("on\n");
  4056.                          }
  4057.     
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.                                                               Page 60
  4097.  
  4098.     
  4099.     Name                  Jul... - family of Julian date conversion
  4100.                                   functions
  4101.     
  4102.     Usage                double JultoCal(double jul);
  4103.                          double JultoCalCent(double jul);
  4104.                          char *JultoGreg(double jul);
  4105.                          char *JultoGregEuro(double jul);
  4106.                          char *JultoGregJap(double jul);
  4107.                          struct ddate *Jultoddate(double jul);
  4108.     
  4109.                          double JulAtoCal(double jul);
  4110.                          double JulAtoCalCent(double jul);
  4111.                          char *JulAtoGreg(double jul);
  4112.                          char *JulAtoGregEuro(double jul);
  4113.                          char *JulAtoGregJap(double jul);
  4114.                          struct ddate *JulAtoddate(double jul);
  4115.     
  4116.                          double JulBtoCal(double jul);
  4117.                          double JulBtoCalCent(double jul);
  4118.                          char *JulBtoGreg(double jul);
  4119.                          char *JulBtoGregEuro(double jul);
  4120.                          char *JulBtoGregJap(double jul);
  4121.                          struct ddate *JulBtoddate(double jul);
  4122.     
  4123.     Prototype in         datehk.h
  4124.     
  4125.     Description          Jul.toCal           converts a Julian date to
  4126.                                              Calendar date
  4127.                          Jul.toCalCent       converts a Julian date to
  4128.                                              Calendar date (w/century)
  4129.                          Jul.toGreg...       converts a Julian date to the
  4130.                                              appropraite Gregorian date
  4131.                          Jul.toddate         converts a Julian date to
  4132.                                              struct ddate
  4133.     
  4134.     Return value         Jul.toCal return a Calendar date
  4135.                          Jul.toCalCent return a Calendar date (w/century)
  4136.                          Jul.toGreg.. return the appropriate Gregorian date
  4137.                          Jul.toddate return a struct ddate
  4138.     
  4139.     See also             Appendix A
  4140.                          Cal...(), fulltoddate(), Greg...(), shorttoddate()
  4141.     
  4142.     Example              see demodate.c
  4143.     
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.                                                               Page 61
  4163.  
  4164.     
  4165.     Name                  leftstr - return the left portion of string
  4166.                           midstr - return a piece of a string
  4167.                           rightstr - return the right portion of a string
  4168.     
  4169.     Usage                char *leftstr(char *source, int len);
  4170.                          char *midstr(char *source, int begin, int len);
  4171.                          char *rightstr(char *source, int len);
  4172.     
  4173.     Prototype in         stringhk.h
  4174.     
  4175.     Description          these functions perform just like their BASIC
  4176.                          counterparts LEFT$(), RIGHT$() and MID$(). 
  4177.     
  4178.                          leftstr returns the left part of a string.
  4179.                          midstr returns the middle part of a string.
  4180.                          rightstr returns the right part of a string.
  4181.     
  4182.     Return value         leftstr returns the leftmost len characters of
  4183.                          source. If the length of source is less than len,
  4184.                          the entire string is returned.
  4185.     
  4186.                          midstr returns the substring of source, using
  4187.                          begin as the offset from the beginning to start
  4188.                          the substring, for len characters.
  4189.     
  4190.                          rightstr returns the rightmost len characters of
  4191.                          source. If the length of source is less than len,
  4192.                          the entire string is returned.
  4193.     
  4194.                          All these functions return a pointer to the
  4195.                          storage location containing the new string, or
  4196.                          NULL if space could not be allocated.
  4197.     
  4198.     Example              #include <stringhk.h>
  4199.                          #include <stdio.h>           /* for the printf */
  4200.     
  4201.                          main()
  4202.                          {
  4203.                               char msg[25], *l, *r, *m;
  4204.     
  4205.                               strcpy(msg,"This is another test");
  4206.                               l = leftstr(msg,7);
  4207.                               r = right(msg,7);
  4208.                               m = midstr(msg,5,7);
  4209.                               printf("%s\n",msg);
  4210.                               printf("%s\n",l);
  4211.                               printf("%s\n",r);
  4212.                               printf("%s\n",m);
  4213.                          }
  4214.     
  4215.     
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.                                                               Page 62
  4229.  
  4230.     Program output       This is another test
  4231.                          This an
  4232.                          er test
  4233.                          is anot
  4234.     
  4235.     
  4236.  
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.                                                               Page 63
  4295.  
  4296.     
  4297.     Name                  lotus_setup - creates info for menu_lotus()
  4298.     
  4299.     Usage                void lotus_setup(int argc, byte *command[],
  4300.                                    char cmdkey[], byte col[], byte
  4301.                                    *message[], byte msglen[]);
  4302.     
  4303.     Prototype in         menuhk.h
  4304.     
  4305.     Description          lotus_setup does a lot of the grunt work necessary
  4306.                          to use menu_lotus() properly. Given the command
  4307.                          and message lists this function will create
  4308.                          cmdkey[], col[] and msglen[].
  4309.     
  4310.     Return value         nothing.
  4311.     
  4312.     See also             menu_lotus()
  4313.     
  4314.     Example              see demo.c
  4315.     
  4316.     
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.                                                               Page 64
  4361.  
  4362.     
  4363.     Name                  memory_strategy - get/set memory alloc strategy
  4364.     
  4365.     Usage                int memory_strategy(boolean read, int *strategy);
  4366.     
  4367.     Prototype in         ibm.h
  4368.     
  4369.     Description          this function will get or set the memory
  4370.                          allocation strategy. The variable read determines
  4371.                          whether the function will read or write (get or
  4372.                          set) the strategy value stored at *strategy.
  4373.     
  4374.     Return value         returns zero if successful (and *strategy is the
  4375.                          strategy being used) or, if an error occurs, the
  4376.                          error code (in which case the value in *strategy
  4377.                          is meaningless.)
  4378.     
  4379.     Note                 this function requires DOS 3.xx.
  4380.     
  4381.     See also             ibm.h
  4382.     
  4383.     Example              #include <ibm.h>
  4384.     
  4385.                          #define GET TRUE        /* read */
  4386.                          #define SET FALSE       /* write */
  4387.     
  4388.                          main()
  4389.                          {
  4390.                               int memstrat;
  4391.     
  4392.                               if (memory_strategy(GET,&memstrat) !=
  4393.                                         MEM_STRAT_BEST)
  4394.                                    memory_strategy(SET,MEM_STRAT_BEST);
  4395.                          }
  4396.          /* Bad, no error checking done. When you document
  4397.             30 functions, you write the best code, don't you? */
  4398.     
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.                                                               Page 65
  4427.  
  4428.     
  4429.     Name                  menu_lotus - Lotus style menu
  4430.     
  4431.     Usage                char menu_lotus(int argc, char cmdkey[], byte
  4432.                          *command[],         byte col[], byte *message[],
  4433.                                              byte msglen[], byte normal,
  4434.                                              byte highlite, byte cmdrow,
  4435.                                              boolean clockon, byte
  4436.                                              clockrow, byte clockcol, byte
  4437.                                              clockcolor);
  4438.     
  4439.     Prototype in         menuhk.h
  4440.     
  4441.     Description          menu_lotus displays a Lotus style 'slash bar' menu
  4442.                          and waits for a menu selection. This function is
  4443.                          modeled after the slash bar menu in Symphony. The
  4444.                          function parameters are:
  4445.     
  4446.                               argc           number of menu choices
  4447.                               cmdkey         array of the 1st letter of
  4448.                                              each command (must be
  4449.                                              capitalized)
  4450.                               command        menu choices
  4451.                               col            columns of 1st letters of menu
  4452.                                              commands (for displaying
  4453.                                              command line)
  4454.                               message        respective messages for menu
  4455.                                              commands
  4456.                               msglen         lengths of messages
  4457.                               normal         color of text
  4458.                               highlite       color of highlited option
  4459.                               cmdrow         row to display command line on
  4460.                               clockon        flag: display a clock?
  4461.                               clockrow       row coordinate of clock
  4462.                               clockcol       column coordinate of clock
  4463.                               clockcolor     color of clock
  4464.     
  4465.                          menu_lotus will display an optional clock (clockon
  4466.                          = TRUE) that is updated every minute. The clock is
  4467.                          displayed as 11:44 PM.
  4468.     
  4469.                          All elements of cmdkey[] MUST be capitalized.
  4470.     
  4471.                          menu_lotus provides limited cursor control, as per
  4472.                          Symphony:
  4473.     
  4474.                               Up Arrow       \ move highlite left 1 choice
  4475.                               Left Arrow     /
  4476.                               Down Arrow     \ move highlite right 1 choice
  4477.                               Right Arrow    /
  4478.                               Home           highlites first command
  4479.                               End            highlites last command
  4480.                               Enter          selects highlited menu choice
  4481.                               ESCape         selects nothing. Returns ESC
  4482.                                              code
  4483.     
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.                                                               Page 66
  4493.  
  4494.     
  4495.                          The cursor keys do not wraparound. Pressing right
  4496.                          arrow at the last menu choice does nothing.
  4497.     
  4498.                          All output is done via putstr().
  4499.     
  4500.     Return value         returns the upper of the 1st letter of the menu
  4501.                          choice selected, or ESC (0x27) if ESC was pressed
  4502.     
  4503.     See also             lotus_setup()
  4504.     
  4505.     Example              see testmenu.c
  4506.     
  4507.     
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.  
  4514.  
  4515.  
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.                                                               Page 67
  4559.  
  4560.     
  4561.     Name                  monthexpand - convert a month abbrev to its name
  4562.     
  4563.     Usage                char *monthexpand(int month);
  4564.     
  4565.     Prototype in         datehk.h
  4566.     
  4567.     Description          monthexpand returns the name of a month given its
  4568.                          numeric abbreviation.
  4569.     
  4570.                          monthexpand returns an element of a static char
  4571.                          array, so you should not make any changes directly
  4572.                          to the returned value, but rather copy the
  4573.                          returned value to a safe piece of memory.
  4574.     
  4575.     Return value         returns a pointer to the storage location
  4576.                          containing the date structure, or NULL if the
  4577.                          month given is invalid.
  4578.     
  4579.     See also             ddatetolong(), ddatetoshort(), ddatetostr(),
  4580.                          monthexpand(), strtoddate()
  4581.     
  4582.     Example              #include <datehk.h>
  4583.     
  4584.                          main()
  4585.                          {
  4586.                               printf("Month 4 = %s\n",monthexpand(4));
  4587.                          }
  4588.     
  4589.     Program output       Month 4 = April
  4590.     
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.                                                               Page 68
  4625.  
  4626.     
  4627.     Name                  putk - put a character w/attribute on the screen
  4628.     
  4629.     Usage                void putk(byte c);
  4630.     
  4631.     Prototype in         video.h
  4632.     
  4633.     Description          putk puts character c on the screen at the cursor
  4634.                          via INTerrupts. The cursor does NOT advance. The
  4635.                          attribute is set with the global variable
  4636.                          char_attribute.
  4637.     
  4638.     Return value         nothing.
  4639.     
  4640.     See also             putsay(), putstr(), set_color()
  4641.     
  4642.     Example              #include <video.h>
  4643.     
  4644.                          main()
  4645.                          {
  4646.                               gotoxy(12,40);
  4647.                               putk('*');
  4648.                          }
  4649.     
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.                                                               Page 69
  4691.  
  4692.     
  4693.     Name                  putsay - put a string with attribute on the
  4694.                          screen
  4695.     
  4696.     Usage                void putsay(byte row, byte col, byte *c);
  4697.     
  4698.     Prototype in         video.h
  4699.     
  4700.     Description          putsay puts string c on the screen at location
  4701.                          (col,row) via direct screen writes. It does
  4702.                          retrace checking to prevent snow on CGA systems.
  4703.                          The attribute is set with the global variable
  4704.                          char_attribute.
  4705.     
  4706.     Return value         nothing.
  4707.     
  4708.     See also             putk(), putstr(), set_color()
  4709.     
  4710.     Example              #include <video.h>
  4711.     
  4712.                          main()
  4713.                          {
  4714.                               putstr(12,40,(byte *)"Hello");
  4715.                          }
  4716.     
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.                                                               Page 70
  4757.  
  4758.     
  4759.     Name                  putstr - put a string with attribute on the
  4760.                          screen
  4761.     
  4762.     Usage                void putstr(byte *c);
  4763.     
  4764.     Prototype in         video.h
  4765.     
  4766.     Description          putstr puts string c on the screen at the cursor
  4767.                          via INTerrupts. When finished the cursor will be 1
  4768.                          spot after the string. The attribute is set with
  4769.                          the global variable char_attribute.
  4770.     
  4771.     Return value         nothing.
  4772.     
  4773.     See also             putk(), putsay(), set_color()
  4774.     
  4775.     Example              #include <video.h>
  4776.     
  4777.                          main()
  4778.                          {
  4779.                               gotoxy(12,40);
  4780.                               putstr((byte *)"Hello");
  4781.                          }
  4782.     
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.                                                               Page 71
  4823.  
  4824.     
  4825.     Name                  read_cursor - reads cursor information
  4826.     
  4827.     Usage                unsigned int read_cursor(byte *row, byte *col);
  4828.     
  4829.     Prototype in         video.h
  4830.     
  4831.     Description          reads the cursor location and scan lines via
  4832.                          INTerrupts.
  4833.     
  4834.     Return value         returns the scan lines of the cursor as a word,
  4835.                          the high order byte the start and low order byte
  4836.                          the end.
  4837.     
  4838.     See also             cursor_blink(), cursor_flip(), cursor_off(),
  4839.                          cursor_on(), set_cursor(), wherex(), wherey()
  4840.     
  4841.     Example              #include <video.h>
  4842.     
  4843.                          main()
  4844.                          {
  4845.                               byte x,y;
  4846.                               unsigned int scan;
  4847.     
  4848.                               scan = read_cursor(&x,&y);
  4849.                               printf("Scan start %d and end %d\n",
  4850.                                    scan&0xFF00, scan&0xFF);
  4851.                          }
  4852.     
  4853.     Program output       Scan start 6 and end 7         /* on CGA */
  4854.     
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.  
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.  
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.                                                               Page 72
  4889.  
  4890.     
  4891.     Name                  read_mode - find screen width, mode and page
  4892.     
  4893.     Usage                void read_mode(byte *width, byte *mode, byte
  4894.                          *page);
  4895.     
  4896.     Prototype in         video.h
  4897.     
  4898.     Description          detects the screen width (number of columns,)
  4899.                          video mode and video page via INT 0x10, Service
  4900.                          0x0F.
  4901.     
  4902.     Return value         nothing.
  4903.     
  4904.     See also             video.h
  4905.                          set_mode()
  4906.     
  4907.     Example              #include <video.h>
  4908.     
  4909.                          main()
  4910.                          {
  4911.                               byte width, mode, page;
  4912.     
  4913.                               read_mode(&width, &mode, &page);
  4914.                               printf("# columns: %d    Mode: %d   Page:
  4915.                                    %d\n", width, mode, page);
  4916.                          }
  4917.     
  4918.     Program output       # columns: 80    Mode: 3   Page: 1
  4919.     
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.                                                               Page 73
  4955.  
  4956.     
  4957.     Name                  reboot - reboots the machine
  4958.     
  4959.     Usage                void reboot(boolean warmboot);
  4960.     
  4961.     Prototype in         ibm.h
  4962.     
  4963.     Description          calling this function will reboot your machine via
  4964.                          the ROM reboot code located at F000:000. You can
  4965.                          specify a warm or cold boot (like hitting
  4966.                          CTRL-ALT-DEL or turning the power on.)
  4967.     
  4968.     Return value         nothing.
  4969.     
  4970.     Example              #include <ibm.h>
  4971.     
  4972.                          main()
  4973.                          {
  4974.                               boolean bootstyle;
  4975.     
  4976.                               /* set bootstyle */
  4977.                               reboot(bootstyle);
  4978.                          }
  4979.     
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.                                                               Page 74
  5021.  
  5022.     
  5023.     Name                  restore_box - restore a part of the screen
  5024.     
  5025.     Usage                void restore_box(byte top, byte left, byte bottom,
  5026.                                    byte right, byte *buffer);
  5027.     
  5028.     Prototype in         video.h
  5029.     
  5030.     Description          restore_box restores part of the current screen
  5031.                          (characters and attributes,) from a block of
  5032.                          memory to the display memory, over the area
  5033.                          delineated by the box coordinates.
  5034.     
  5035.                          restore_box will write buffer's contents to the
  5036.                          display memory over the location given by the box
  5037.                          coordinates. With this function it is possible to
  5038.                          restore a screen segment multiple times to
  5039.                          different areas of the screen, allowing quick
  5040.                          display of multiple images.
  5041.     
  5042.     Return value         nothing.
  5043.     
  5044.     See also             restore_screen(), save_box(), save_screen(),
  5045.                          scrbuff()
  5046.     
  5047.     Example              #include <video.h>
  5048.     
  5049.                          main()
  5050.                          {
  5051.                               byte buffer[0x2000];
  5052.     
  5053.                               save_box(0,0,25,39,buffer);
  5054.                               /* save left half of the screen */
  5055.                               restore_box(0,40,25,79,buffer);
  5056.                               /* restore it on the right half of screen */
  5057.                          }
  5058.     
  5059.     
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.                                                               Page 75
  5087.  
  5088.     
  5089.     Name                  restore_screen - restore screen
  5090.     
  5091.     Usage                void restore_screen(byte *buffer);
  5092.     
  5093.     Prototype in         video.h
  5094.     
  5095.     Description          restore_screen restores the current screen
  5096.                          (characters and attributes) from a block of
  5097.                          memory.
  5098.     
  5099.                          restore_screen will copy 4K from the memory
  5100.                          location pointed to by buffer to the display
  5101.                          memory.
  5102.     
  5103.     Return value         nothing.
  5104.     
  5105.     See also             restore_box(), save_box(), save_screen(),
  5106.                          scrbuff()
  5107.     
  5108.     Example              #include <video.h>
  5109.     
  5110.                          main()
  5111.                          {
  5112.                               byte buffer[0x4000];
  5113.     
  5114.                               save_screen(buffer);
  5115.                          /* display some stuff */
  5116.                               restore_screen(buffer);
  5117.                          }
  5118.     
  5119.     
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.                                                               Page 76
  5153.  
  5154.     
  5155.     Name                  ROM_date - gets the ROM id date
  5156.     
  5157.     Usage                byte ROM_date(void);
  5158.     
  5159.     Prototype in         ibm.h
  5160.     
  5161.     Description          finds the ROM id date at F000:FFF5
  5162.     
  5163.     Return value         returns a pointer to the storage location
  5164.                          containing the string, or NULL if space could not
  5165.                          be allocated.
  5166.     
  5167.     See also             ROM_id()
  5168.     
  5169.     Example              #include <ibm.h>
  5170.                          #include <stdio.h>
  5171.     
  5172.                          main()
  5173.                          {
  5174.                               printf("ROM BIOS date = %s",ROM_date());
  5175.                          }
  5176.     
  5177.     Program output       ROM BIOS date = 06/10/85
  5178.     
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.                                                               Page 77
  5219.  
  5220.     
  5221.     Name                  ROM_id - gets the ROM id byte
  5222.     
  5223.     Usage                byte ROM_id(void);
  5224.     
  5225.     Prototype in         ibm.h
  5226.     
  5227.     Description          finds the ROM id byte at F000:FFFE
  5228.     
  5229.     Return value         returns the ROM id byte
  5230.     
  5231.     Note                 on Compaq machines the ROM id byte is found at a
  5232.                          memory location close to, but not at, F000:FFFE.
  5233.                          Not having access to a Compaq, I did not include a
  5234.                          check for this. Maybe a future version...
  5235.     
  5236.     See also             ROM_date()
  5237.     
  5238.     Example              #include <ibm.h>
  5239.                          #include <stdio.h>
  5240.     
  5241.                          main()
  5242.                          {
  5243.                               printf("ROM id byte = %X",ROM_id());
  5244.                          }
  5245.     
  5246.     Program output       ROM id byte = FF
  5247.     
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.                                                               Page 78
  5285.  
  5286.     
  5287.     Name                  save_box - save a part of the screen
  5288.     
  5289.     Usage                void save_box(byte top, byte left, byte bottom,
  5290.                                    byte right, byte *buffer);
  5291.     
  5292.     Prototype in         video.h
  5293.     
  5294.     Description          save_box saves part of the current screen
  5295.                          (characters and attributes,) delineated by the box
  5296.                          coordinates, to a block of memory.
  5297.     
  5298.                          buffer MUST be at least big enough to store the
  5299.                          box. save_box will write over memory beginning
  5300.                          with the memory location pointed to by buffer.
  5301.     
  5302.     Return value         nothing.
  5303.     
  5304.     See also             restore_box(), restore_screen(), save_screen(),
  5305.                          scrbuff()
  5306.     
  5307.     Example              #include <video.h>
  5308.     
  5309.                          main()
  5310.                          {
  5311.                               byte buffer[0x2000];
  5312.     
  5313.                               save_box(0,0,25,39,buffer);  /* save left
  5314.                               half */
  5315.                          }                                 /* of screen    
  5316.                           */
  5317.     
  5318.     
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.                                                               Page 79
  5351.  
  5352.     
  5353.     Name                  save_screen - save screen
  5354.     
  5355.     Usage                void save_screen(byte *buffer);
  5356.     
  5357.     Prototype in         video.h
  5358.     
  5359.     Description          save_screen saves the current screen (characters
  5360.                          and attributes) to a block of memory.
  5361.     
  5362.                          buffer MUST be at least 4K big. save_screen will
  5363.                          write over 4K beginning with the memory location
  5364.                          pointed to by buffer.
  5365.     
  5366.     Return value         nothing.
  5367.     
  5368.     See also             restore_box(), restore_screen(), save_box(),
  5369.                          scrbuff()
  5370.     
  5371.     Example              #include <video.h>
  5372.     
  5373.                          main()
  5374.                          {
  5375.                               byte buffer[0x4000];
  5376.     
  5377.                               save_screen(buffer);
  5378.                          }
  5379.     
  5380.     
  5381.  
  5382.  
  5383.  
  5384.  
  5385.  
  5386.  
  5387.  
  5388.  
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.                                                               Page 80
  5417.  
  5418.     
  5419.     Name                  scrbuff - calculate size of screen buffer
  5420.     
  5421.     Usage                #define scrbuff(t,l,b,r)
  5422.     
  5423.     Prototype in         video.h
  5424.     
  5425.     Description          this is really just a define to calculate the size
  5426.                          of a buffer need by the save_screen() and
  5427.                          save_box() functions.
  5428.     
  5429.     Return value         returns the number of bytes needed to store a
  5430.                          segment of screen from (t,l) to (b,r), with
  5431.                          attributes.
  5432.     
  5433.     See also             video.h
  5434.                          restore_box(), restore_screen(), save_box(),
  5435.                          save_screen()
  5436.     
  5437.     Example              #include <video.h>
  5438.     
  5439.                          main()
  5440.                          {
  5441.                               byte buffer[scrbuff(0,0,25,39)];
  5442.     
  5443.                               save_box(0,0,25,39,buffer);
  5444.                               /* save left half of the screen */
  5445.                               restore_box(0,40,25,79,buffer);
  5446.                               /* restore it on the right half of screen */
  5447.                          }
  5448.     
  5449.  
  5450.  
  5451.  
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.                                                               Page 81
  5483.  
  5484.     
  5485.     Name                  scroll_down - scroll window down
  5486.     
  5487.     Usage                void scroll_down(byte top, byte left, byte bottom,
  5488.                                         byte right);
  5489.     
  5490.     Prototype in         video.h
  5491.     
  5492.     Description          scroll box delineated by the coordinates down 1
  5493.                          line. A blank line will be inserted at the top,
  5494.                          and the bottom line will be lost.
  5495.     
  5496.     Return value         nothing.
  5497.     
  5498.     See also             scroll_up()
  5499.     
  5500.     Example              #include <video.h>
  5501.     
  5502.                          main()
  5503.                          {
  5504.                               scroll_down(0,0,4,79);
  5505.                               /* scroll bottom 4 lines */
  5506.                          }
  5507.     
  5508.     
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.                                                               Page 82
  5549.  
  5550.     
  5551.     Name                  scroll_up - scroll window up
  5552.     
  5553.     Usage                void scroll_up(byte top, byte left, byte bottom,
  5554.                                         byte right);
  5555.     
  5556.     Prototype in         video.h
  5557.     
  5558.     Description          scroll box delineated by the coordinates up 1
  5559.                          line. A blank line will be inserted at the bottom,
  5560.                          and the top line will be lost.
  5561.     
  5562.     Return value         nothing.
  5563.     
  5564.     See also             scroll_down()
  5565.     
  5566.     Example              #include <video.h>
  5567.     
  5568.                          main()
  5569.                          {
  5570.                               scroll_up(0,0,4,79); /* scroll top 4 lines */
  5571.                          }
  5572.     
  5573.     
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614.                                                               Page 83
  5615.  
  5616.     
  5617.     Name                  setBREAK - set Ctrl-BREAK flag
  5618.     
  5619.     Usage                boolean setBREAK(boolean break_status);
  5620.     
  5621.     Prototype in         ibm.h
  5622.     
  5623.     Description          sets the state of the Ctrl-BREAK flag. The BREAK
  5624.                          status flag can be set from DOS by BREAK ON or
  5625.                          BREAK OFF.
  5626.     
  5627.     Return value         returns TRUE if the break flag is on, FALSE if the
  5628.                          flag is off.
  5629.     
  5630.     Note                 the return value is based on the CURRENT setting.
  5631.                          If you set the break flag, setBREAK will return
  5632.                          what you set the flag to, not what the flag was
  5633.                          set to before.
  5634.     
  5635.     See also             isBREAKon(), isVERIFYon(), setVERIFY()
  5636.     
  5637.     Example              #include <ibm.h>
  5638.     
  5639.                          main()
  5640.                          {
  5641.                               printf("BREAK flag was ");
  5642.                               if (! setBREAK(TRUE))
  5643.                                    printf("not ");
  5644.                               printf("on\n");
  5645.                          }
  5646.     
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.                                                               Page 84
  5681.  
  5682.     
  5683.     Name                  set_color - set the default attribute (color)
  5684.     
  5685.     Usage                void set_color(byte colors);
  5686.     
  5687.     Prototype in         video.h
  5688.     
  5689.     Description          set_color just sets the global variable
  5690.                          char_attribute to colors. I got tired of declaring
  5691.                          char_attribute as extern in every function that
  5692.                          output to the screen, so I made this function.
  5693.     
  5694.     Return value         nothing.
  5695.     
  5696.     See also             putk(), putstr()
  5697.     
  5698.     Example              #include <video.h>
  5699.                          #include <color.h>
  5700.     
  5701.                          main()
  5702.                          {
  5703.                               set_color(RED | B_WHITE | BLINK);
  5704.                               /* red blinking text on white background */
  5705.                               gotoxy(12,40);
  5706.                               putstr((byte *)"Hello");
  5707.                          }
  5708.     
  5709.     
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.                                                               Page 85
  5747.  
  5748.     
  5749.     Name                  set_cursor - sets cursor scan lines
  5750.     
  5751.     Usage                void set_cursor(byte start, byte end);
  5752.     
  5753.     Prototype in         video.h
  5754.     
  5755.     Description          sets the cursor scan lines via INTerrupts.
  5756.     
  5757.     Return value         nothing.
  5758.     
  5759.     See also             cursor_blink(), cursor_flip(), cursor_off(),
  5760.                          cursor_on(), read_cursor()
  5761.     
  5762.     Example              #include <video.h>
  5763.     
  5764.                          main()
  5765.                          {
  5766.                               set_cursor(0,7);
  5767.                          }
  5768.     
  5769.     
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.                                                               Page 86
  5813.  
  5814.     
  5815.     Name                  set_handles - set handle count
  5816.     
  5817.     Usage                int set_handles(int handles);
  5818.     
  5819.     Prototype in         filehk.h
  5820.     
  5821.     Description          sets the handle count via DOS Function 0x67. If
  5822.                          more than 255 handles are specified (the maximum
  5823.                          allowable) set_handle tried to set the handle
  5824.                          count to 255.
  5825.     
  5826.     Return value         returns zero if execution was successful, a
  5827.                          nonzero error code otherwise.
  5828.     
  5829.     Note                 This function requires DOS 3.3+.
  5830.     
  5831.     Example              #include <filehk.h>
  5832.     
  5833.                          main()
  5834.                          {
  5835.                               set_handles(127);
  5836.                          }
  5837.     
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.                                                               Page 87
  5879.  
  5880.     
  5881.     Name                  setVERIFY - set VERIFY flag
  5882.     
  5883.     Usage                boolean setVERIFY(boolean verify_status);
  5884.     
  5885.     Prototype in         ibm.h
  5886.     
  5887.     Description          sets the state of the verify flag. The VERIFY
  5888.                          status flag can be set from DOS by VERIFY ON or
  5889.                          VERIFY OFF.
  5890.     
  5891.     Return value         returns TRUE if the verify flag is on, FALSE if
  5892.                          the flag is off.
  5893.     
  5894.     Note                 the return value is based on the CURRENT setting.
  5895.                          If you set the verify flag, setVERIFY will return
  5896.                          what you set the flag to, not what the flag was
  5897.                          set to before.
  5898.     
  5899.     See also             isBREAKon(), isVERIFYon(), setBREAK()
  5900.     
  5901.     Example              #include <ibm.h>
  5902.     
  5903.                          main()
  5904.                          {
  5905.                               printf("VERIFY flag was ");
  5906.                               if (! setVERIFY(TRUE))
  5907.                                    printf("not ");
  5908.                               printf("on\n");
  5909.                          }
  5910.     
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.                                                               Page 88
  5945.  
  5946.     
  5947.     Name                  set_mode - set the video mode
  5948.     
  5949.     Usage                void set_mode(byte mode);
  5950.     
  5951.     Prototype in         video.h
  5952.     
  5953.     Description          sets the video mode via INT 0x10, Service 0.
  5954.     
  5955.     Return value         nothing.
  5956.     
  5957.     See also             video.h
  5958.                          read_mode()
  5959.     
  5960.     Example              #include <video.h>
  5961.     
  5962.                          main()
  5963.                          {
  5964.                               set_mode(3);       /* text mode */
  5965.                               printf("# columns: %d    Mode: %d   Page:
  5966.                                    %d\n", width, mode, page);
  5967.                          }
  5968.     
  5969.     Program output       # columns: 80    Mode: 3   Page: 1
  5970.     
  5971.     
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.                                                               Page 89
  6011.  
  6012.     
  6013.     Name                  strcomma - convert a string to xx,xxx,xxx format
  6014.     
  6015.     Usage                char *strcomma(char *source); 
  6016.     
  6017.     Prototype in         stringhk.h
  6018.     
  6019.     Description          strcomma converts a string of numbers into the
  6020.                          comma delimited format (xx,xxx,xxx). The number is
  6021.                          terminated by a non-digit (any character other
  6022.                          than 0-9.) A leading sign will be copied before
  6023.                          converting the number. This function is used
  6024.                          internally by strtodol.
  6025.     
  6026.     Return value         returns a pointer to the storage location
  6027.                          containing the comma formatted string, or NULL if
  6028.                          space could not be allocated. The returned string
  6029.                          is NOT the same as the string passed to the
  6030.                          function. This function does NOT write over the
  6031.                          string passed to it.
  6032.     
  6033.     Example              #include <stringhk.h>
  6034.                          #include <stdio.h>           /* for the printf */
  6035.     
  6036.                          main()
  6037.                          {
  6038.                               char sint[15], *comma
  6039.     
  6040.                               strcpy(sint,"12839.44");
  6041.                               comma = strcomma(sint);
  6042.                               printf("%s -> %s\n",sint,comma);
  6043.                          }
  6044.          
  6045.     Program output       12839.44 -> 12,839.44
  6046.     
  6047.     
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.                                                               Page 90
  6077.  
  6078.     
  6079.     Name                  strdel - delete part of a string
  6080.     
  6081.     Usage                char *strdel(char *source, char *old);
  6082.     
  6083.     Prototype in         stringhk.h
  6084.     
  6085.     Description          strdel deletes the first occurence of the string
  6086.                          old from the string source. This function is case
  6087.                          dependent.
  6088.     
  6089.     Return value         returns source
  6090.     
  6091.     Example              #include <stringhk.h>
  6092.                          #include <stdio.h>           /* for the printf */
  6093.     
  6094.                          main()
  6095.                          {
  6096.                               char msg[45], fragment[15];
  6097.     
  6098.                               strcpy(msg,"Did you register yet? Did you?");
  6099.                               strpy(fragment,"you");
  6100.                               printf("  [%s]\n",msg);
  6101.                               printf("- [%s]\n",fragment);
  6102.                               printf("= [%s]\n",msg);
  6103.                          }
  6104.     
  6105.     Program output         [Did you register yet? Did you?]
  6106.                          - [you]
  6107.                          = [Did  register yet? Did you?]
  6108.     
  6109.     
  6110.  
  6111.  
  6112.  
  6113.  
  6114.  
  6115.  
  6116.  
  6117.  
  6118.  
  6119.  
  6120.  
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142.                                                               Page 91
  6143.  
  6144.     
  6145.     Name                  strins - insert one string into another
  6146.     
  6147.     Usage                char *strins(char *source, char *new, char *ptr);
  6148.     
  6149.     Prototype in         stringhk.h
  6150.     
  6151.     Description          strins inserts the string new into the string
  6152.                          source at the location ptr in source. Basically,
  6153.                          strins copies source up to, but not including, ptr
  6154.                          into a new location, concatenates the new
  6155.                          (inserted) string, and then concatenates the
  6156.                          remainder of source (the string pointed to by
  6157.                          ptr.)
  6158.     
  6159.     Return value         returns a pointer to the storage location
  6160.                          containing the newly concatenated string, or NULL
  6161.                          if space could not be allocated. The returned
  6162.                          string is NOT the same as the string passed to the
  6163.                          function. This function does NOT write over the
  6164.                          string passed to it.
  6165.     
  6166.     Example              #include <stringhk.h>
  6167.                          #include <stdio.h>           /* for the printf */
  6168.     
  6169.                          main()
  6170.                          {
  6171.                               char old[25], *ptr, *new;
  6172.     
  6173.                               strcpy(old,"ABCDEFG");
  6174.                               ptr = old + 3;            /* *ptr = 'D' */
  6175.                               new = strins(old,"abc",ptr);
  6176.                               printf("%s -> %s\n",old,new);
  6177.                          }
  6178.     
  6179.     Program output       ABCDEDFG -> ABCabcDEFG
  6180.     
  6181.     
  6182.  
  6183.  
  6184.  
  6185.  
  6186.  
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.                                                               Page 92
  6209.  
  6210.     
  6211.     Name                  strrep - replicate a char
  6212.     
  6213.     Usage                char *strrep(char c, int len);
  6214.     
  6215.     Prototype in         stringhk.h
  6216.     
  6217.     Description          strrep copies creates a string len long entirely
  6218.                          of character c.
  6219.     
  6220.     Return value         returns a pointer to the storage location
  6221.                          containing the newly replicated string, or NULL if
  6222.                          space could not be allocated.
  6223.     
  6224.     Example              #include <stringhk.h>
  6225.                          #include <stdio.h>           /* for the printf */
  6226.     
  6227.                          main()
  6228.                          {
  6229.                               char *rep;
  6230.     
  6231.                               printf("%s\n",rep = strrep('k',7));
  6232.                          }
  6233.     
  6234.     Program output       kkkkkkk
  6235.     
  6236.     
  6237.  
  6238.  
  6239.  
  6240.  
  6241.  
  6242.  
  6243.  
  6244.  
  6245.  
  6246.  
  6247.  
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.                                                               Page 93
  6275.  
  6276.     
  6277.     Name                  strshleft - shift string left
  6278.                           strshright - shift string right
  6279.     
  6280.     Usage                void strshleft(char *source, int count);
  6281.                          void strshright(char *source, int count);
  6282.     
  6283.     Prototype in         stringhk.h
  6284.     
  6285.     Description          these functions shift the characters in the string
  6286.                          source left or right, respectively, count places,
  6287.                          padding with spaces.
  6288.     
  6289.     Return value         returns source.
  6290.     
  6291.     Example              #include <stringhk.h>
  6292.                          #include <stdio.h>           /* for the printf */
  6293.     
  6294.                          main()
  6295.                          {
  6296.                               char msg[25];
  6297.     
  6298.                               strcpy(msg,"Buy a Mac II");
  6299.                               printf("%s\n",msg);
  6300.                               printf("%s\n",strshleft(msg,4));
  6301.                               printf("%s\n",strshright(msg,4));
  6302.                          }
  6303.     
  6304.     Program output       Buy a Mac II
  6305.                          a Mac II
  6306.                              Buy a Ma
  6307.     
  6308.     
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.                                                               Page 94
  6341.  
  6342.     
  6343.     Name                  strtoddate - convert a date string to a
  6344.                          structure
  6345.     
  6346.     Usage                struct ddate *strtoddate(char *source); 
  6347.     
  6348.     Prototype in         datehk.h
  6349.     
  6350.     Description          strtoddate converts a date abbreviation to a
  6351.                          structure of type ddate. The abbreviation can use
  6352.                          dashes or slashes (- or /) to separate the fields
  6353.                          of the date. All fields MUST be of length two
  6354.                          (i.e. 02/07/87 is valid, but 2/7/87 and 02/07/1987
  6355.                          are not valid.)
  6356.     
  6357.     Return value         returns a pointer to the storage location
  6358.                          containing the date structure, or NULL if space
  6359.                          could not be allocated.
  6360.     
  6361.     See also             ddatetolong(), ddatetoshort(), monthexpand(),
  6362.                          strtoddate()
  6363.     
  6364.     Example              #include <datehk.h>
  6365.     
  6366.                          main()
  6367.                          {
  6368.                               struct ddate *today;
  6369.                               char strtoday[9];
  6370.     
  6371.                               strcpy(strtoday,"04/01/67");
  6372.                               if ((today = strtoddate(strtoday) != NULL) {
  6373.                                    printf("today is %d-%d-%d\n",
  6374.                                         today->dmon, today->dday,
  6375.                                         today->dyear);
  6376.                                    printf("or %s\n", strtoday);
  6377.                               }
  6378.                          }
  6379.     
  6380.     Program output       today is 4-1-67
  6381.                          or 04/01/67
  6382.     
  6383.     
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406.                                                               Page 95
  6407.  
  6408.     
  6409.     Name                  strtodol - converts a string to dollar format
  6410.     
  6411.     Usage                char *strtodol(char *source); 
  6412.     
  6413.     Prototype in         stringhk.h
  6414.     
  6415.     Description          strtodol converts a string pointed to by source to
  6416.                          dollar format ($-12,839.44). An optional leading
  6417.                          sign is copied. Only the first 2 decimal places
  6418.                          are copied (the string is truncated, not rounded.)
  6419.                          
  6420.     
  6421.     Return value         returns a pointer to the storage location
  6422.                          containing the dollar formatted string, or NULL if
  6423.                          space could not be allocated. The returned string
  6424.                          is NOT the same as the string passed to the
  6425.                          function. This function does NOT write over the
  6426.                          string passed to it.
  6427.     
  6428.     Example              #include <stringhk.h>
  6429.                          #include <stdio.h>           /* for the printf */
  6430.     
  6431.                          main()
  6432.                          {
  6433.                               char sint[15], *dollar
  6434.     
  6435.                               strcpy(sint,"12839.44");
  6436.                               dollar = strtodol(sint);
  6437.                               printf("%s -> %s\n",sint,dollar);
  6438.                               strcpy(sint,"+62939445.1");
  6439.                               dollar = strtodol(sint);
  6440.                               printf("%s -> %s\n",sint,dollar);
  6441.                          }
  6442.          
  6443.     Program output       12839.44 -> $12,839.44
  6444.                          +62939445.1 -> $+62,939,445.10
  6445.     
  6446.     
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.                                                               Page 96
  6473.  
  6474.     
  6475.     Name                  strtotime - convert a string to a time structure
  6476.     
  6477.     Usage                struct time *strtotime(char *source);
  6478.     
  6479.     Prototype in         timehk.h
  6480.     
  6481.     Description          strtotime converts a string to a time structure,
  6482.                          checking for AM/PM or 24-hour format. If seconds
  6483.                          or hundredths of seconds are not in the string,
  6484.                          their values will be set to 0 in the structure.
  6485.     
  6486.     Return value         returns a pointer to the storage location
  6487.                          containing the time string, or NULL if space could
  6488.                          not be allocated.
  6489.     
  6490.     See also             timetostr()
  6491.     
  6492.     Example              #include <timehk.h>
  6493.     
  6494.                          main()
  6495.                          {
  6496.                               struct time *now;
  6497.     
  6498.                               strcpy(strnow,"5:12 PM");
  6499.                               if ((now = strtotime(strnow)) != NULL)
  6500.                                    printf("%d hours, %d min, %d.%d secs\n",
  6501.                                         now->ti_hour, now->ti_min,
  6502.                                         now->ti_sec, now->ti_hund);
  6503.                          }
  6504.     
  6505.     Program output       17 hours, 12 min, 0.0 secs
  6506.     
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.                                                               Page 97
  6539.  
  6540.     
  6541.     Name                  timetostr - convert time structure to a string
  6542.     
  6543.     Usage                char *timetostr(struct time *tsource, boolean
  6544.                                         seconds, boolean hundreds, boolean
  6545.                                         ampm);
  6546.     
  6547.     Prototype in         timehk.h
  6548.     
  6549.     Description          timetostr converts a time structure to a string,
  6550.                          with the following options:
  6551.     
  6552.                               seconds  = put seconds in string
  6553.                               hundreds = put hundreths of seconds in string
  6554.                               ampm     = append AM/PM to string
  6555.     
  6556.                          if ampm is FALSE, 24-hour time will be used.
  6557.     
  6558.                          if hundreds is TRUE, seconds are automatically put
  6559.                          into the string.
  6560.     
  6561.     Return value         returns a pointer to the storage location
  6562.                          containing the time string, or NULL if space could
  6563.                          not be allocated.
  6564.     
  6565.     See also             strtotime()
  6566.     
  6567.     Example              #include <timehk.h>
  6568.     
  6569.                          main()
  6570.                          {
  6571.                               char *strnow;
  6572.                               struct time now;
  6573.     
  6574.                               gettime(&now);
  6575.                               if ((strnow = timetostr(&now, FALSE, TRUE,
  6576.                                                             TRUE)) != NULL)
  6577.                                    printf("The time is %s\n",strnow);
  6578.                          }
  6579.     
  6580.     Program output       The time is 11:23:14.22 PM
  6581.     
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604.                                                               Page 98
  6605.  
  6606.     
  6607.     Name                  valid_date - check if a date is valid
  6608.     
  6609.     Usage                boolean valid_date(int month, int day, int
  6610.                          yearnum);
  6611.     
  6612.     Prototype in         datehk.h
  6613.     
  6614.     Description          valid_date checks if the given date is valid.
  6615.     
  6616.     Return value         returns TRUE if the date is valid, FALSE
  6617.                          otherwise.
  6618.     
  6619.     See also             isleapyear()
  6620.     
  6621.     Example              #include <datehk.h>
  6622.     
  6623.                          main()
  6624.                          {
  6625.                               int i, d[3] = { 11, 5, 2 }, m[3] = { 31, 12,
  6626.                               29},
  6627.                                    y[3] = { 70, 1987, 1981 };
  6628.     
  6629.                               for (i=0; i<3; ++) {
  6630.                                    printf("%d/%d/%d  ", m[i], d[i], y[i]);
  6631.                                    if (valid_date(m[i], d[i], y[i])
  6632.                                         printf("valid\n");
  6633.                                    else
  6634.                                         printf("INVALID\n");
  6635.                               }
  6636.                          }
  6637.     
  6638.     Program output       11/31/70  INVALID       /* Nov has 30 days */
  6639.                          5/13/1987  valid
  6640.                          2/29/1981  INVALID      /* 1981 not a leap year */
  6641.     
  6642.  
  6643.  
  6644.  
  6645.  
  6646.  
  6647.  
  6648.  
  6649.  
  6650.  
  6651.  
  6652.  
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.                                                               Page 99
  6671.  
  6672.     
  6673.     Name                  vert_line - draw a vertical line
  6674.     
  6675.     Usage                void vert_line(byte c, unsigned int len, byte row,
  6676.                                         byte col);
  6677.     
  6678.     Prototype in         video.h
  6679.     
  6680.     Description          draws a vertical line of characters c of length
  6681.                          len beginning at (col,row) via INTerrupts.
  6682.     
  6683.                          vert_line does no error checking on the passed
  6684.                          parameters.
  6685.     
  6686.     Return value         nothing.
  6687.     
  6688.     See also             box(), horiz_line(), restore_box(),
  6689.                          restore_screen(), save_box(), save_screen()
  6690.     
  6691.     Example              #include <video.h>
  6692.     
  6693.                          main()
  6694.                          {
  6695.                               vert_line('*',7,4,4);   /* draw 7 *'s at
  6696.                               (4,4) */
  6697.                          }
  6698.     
  6699.     
  6700.  
  6701.  
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.  
  6709.  
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.  
  6728.  
  6729.  
  6730.  
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.                                                               Page 100
  6737.  
  6738.     
  6739.     Name                  wherex - X-coordinate of cursor 
  6740.     
  6741.     Usage                byte wherex(void);
  6742.     
  6743.     Prototype in         video.h
  6744.     
  6745.     Description          returns the X-coordinate (column) of the cursor's
  6746.                          current location via INT 0x10, Service 3.
  6747.     
  6748.     Return value         returns the X-coordinate of the cursor's current
  6749.                          location.
  6750.     
  6751.     See also             gotoxy(), read_cursor(), wherey()
  6752.     
  6753.     Example              #include <video.h>
  6754.     
  6755.                          main()
  6756.                          {
  6757.                               printf("Cursor's column = %d\n",wherex());
  6758.                          }
  6759.     
  6760.     Program output       Cursor's column = 12
  6761.     
  6762.  
  6763.  
  6764.  
  6765.  
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.                                                               Page 101
  6803.  
  6804.     
  6805.     Name                  wherey - y-coordinate of cursor 
  6806.     
  6807.     Usage                byte wherey(void);
  6808.     
  6809.     Prototype in         video.h
  6810.     
  6811.     Description          returns the Y-coordinate (row) of the cursor's
  6812.                          current location via INT 0x10, Service 3.
  6813.     
  6814.     Return value         returns the Y-coordinate of the cursor's current
  6815.                          location.
  6816.     
  6817.     See also             gotoxy(), read_cursor(), wherex()
  6818.     
  6819.     Example              #include <video.h>
  6820.     
  6821.                          main()
  6822.                          {
  6823.                               printf("Cursor's row = %d\n",wherey());
  6824.                          }
  6825.     
  6826.     Program output       Cursor's row = 4
  6827.     
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.  
  6860.  
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867.  
  6868.                                                               Page 102
  6869.  
  6870.                                     #DEFINES
  6871.     
  6872.           Most of these #defines are self-explanatory. All can be found in
  6873.           the appropriate header files:
  6874.     
  6875.     
  6876.      Datehk.h
  6877.     --------
  6878.     
  6879.           Date definitions:
  6880.     
  6881.                typedef enum { Sun, Mon, Tues, Wed, Thrus, Fri, Sat } days;
  6882.                typedef enum { Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep,
  6883.                               Oct, Nov, Dec } months;
  6884.     
  6885.           My date structure:
  6886.     
  6887.                typedef struct ddate {
  6888.                               int dyear;     /* Year - 1900 */
  6889.                               int dday;      /* Day of month (1-31) */
  6890.                               months dmon;   /* Month (Jan = 0) */
  6891.                          };
  6892.     
  6893.          Note: the year is stored as Year - 1900. For example, if you
  6894.                wanted to store 1987 in the variable d (of type struct
  6895.                ddate), you would:       d.dyear = 87;
  6896.                Also note that the months start with zero for January.
  6897.     
  6898.           Date constants:
  6899.     
  6900.                #define DATENULL      "  -  -  "   /* empty date string */
  6901.                #define DATECHAR      '-'          /* date delimiter char */
  6902.                #define DATECHARSTR   "-"          /* date delim. string */
  6903.                #define DATECHARTEST  "/- "        /* all date delimiters */
  6904.                #define BASE_LEAP_YEAR  1980       /* base year for leap
  6905.                                                        year calculations */
  6906.                #define BASE_JUL_YEAR   1720982    /* base day for Julian
  6907.                                                        Type E calcs */
  6908.     
  6909.     
  6910.      Filehk.h
  6911.     --------
  6912.     
  6913.           File constants:
  6914.     
  6915.                #define FNAMESIZE  64              /* d:\path\filename.ext =
  6916.                                                   2 + 49 + 12 + 1 (\0) */
  6917.     
  6918.     
  6919.      Howard.h
  6920.     --------
  6921.     
  6922.           Boolean constants:
  6923.     
  6924.                #define TRUE  1
  6925.                #define FALSE 0
  6926.     
  6927.  
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.                                                               Page 103
  6935.  
  6936.     
  6937.     
  6938.      Ibm.h
  6939.     -----
  6940.     
  6941.           Machine id byte:
  6942.     
  6943.                #define PC            0xFF
  6944.                #define XT            0xFE
  6945.                #define Portable_PC   0xFE
  6946.                #define PCjr          0xFD
  6947.                #define AT            0xFC
  6948.                #define Compaq        0x2D
  6949.                #define Compaq_Plus   0x9A
  6950.     
  6951.           Memory allocation strategies:
  6952.     
  6953.                #define MEM_STRAT_FIRST 0          /* use first mem block
  6954.                                                        large enough */
  6955.                #define MEM_STRAT_BEST  1          /* use smallest mem block
  6956.                                                        large enough */
  6957.                #define MEM_STRAT_LAST  2          /* use high part of last
  6958.                                                        usable mem block */
  6959.                #define MEM_STRAT_BADDOS -1        /* using DOS earlier than
  6960.                                                        3.xx */
  6961.     
  6962.           Disk id bytes:
  6963.     
  6964.                #define DISK_DSDD_8     0xFF  /* Double-sided, 5 1/4"
  6965.                                                   floppy, 8 sectors */
  6966.                #define DISK_SSDD_8     0xFE  /* Single-sided, 5 1/4"
  6967.                                                   floppy, 8 sectors */
  6968.                #define DISK_SS8_8      0xFE  /* Single-sided, 8" floppy,
  6969.                                                   8 sectors */
  6970.                #define DISK_DSDD_9     0xFD  /* Double-sided, 5 1/4"
  6971.                                                   floppy, 9 sectors */
  6972.                #define DISK_SSDD_9     0xFC  /* Single-sided floppy,
  6973.                                                   9 sectors */
  6974.                #define DISK_DSQD_15    0xF9  /* Double-sided, 5 1/4"
  6975.                                                   floppy, 15 sectors */
  6976.                #define DISK_DS3_15     0xF9  /* Double-sided, 3 1/2"
  6977.                                                   floppy, 9 sectors */
  6978.                #define DISK_HARD       0xF8  /* Hard disk */
  6979.                #define DISK_DS3_18     0xF0  /* Double-sided, 3 1/2"
  6980.                                                   floppy, 18 sectors */
  6981.                #define DISK_UNDEFINED  0xF0  /* undefined media type */
  6982.                #define DISK_ERROR      0x0   /* error, try checking
  6983.                                                   _doserrno */
  6984.     
  6985.                Note: if the disk is Single-sided, 8" 26 sectors,
  6986.                      it could have the id FE or FD
  6987.     
  6988.     
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.                                                               Page 104
  7001.  
  7002.           EMS return codes:
  7003.     
  7004.                #define EMS_ERROR_SOFTWARE  0x80   /* err in EMM software */
  7005.                #define EMS_ERROR_HARDWARE  0x81   /* malfunction in EM
  7006.                                                        hardware */
  7007.                #define EMS_ERROR_UNDEFINED 0x84   /* function requested not
  7008.                                                        defined */
  7009.     
  7010.     
  7011.      Math.h
  7012.     ------
  7013.     
  7014.          Math constants:
  7015.     
  7016.                #define SQRT2   1.41421356237309504880
  7017.                #define PI  3.141592653589793238462643
  7018.                #define E   2.7182818284590452353602874
  7019.     
  7020.          Math functions:
  7021.     
  7022.                #define sqr(x)      ((x) * (x))
  7023.                #define sgn(x)      ((x) < 0 ? -1 : 1)
  7024.                #define sign(x)     ((x) < 0 ? -1 : 1)
  7025.                #define swap(x,y)   x^=y, y^=x, x^=y
  7026.                #define max(x,y)    ((x) >= (y) ? (x) : (y))
  7027.                #define min(x,y)    ((x) <= (y) ? (x) : (y))
  7028.     
  7029.     
  7030.      Video.h
  7031.     -------
  7032.     
  7033.           Low memory address values:
  7034.     
  7035.                #define VIDEO     0x10
  7036.                     /* VIDEO INTerrupt service */
  7037.                #define MODE      *((byte far *) 0x449lu)
  7038.                     /* current video mode */
  7039.                #define PAGE      *((byte far *) 0x462lu)
  7040.                     /* current display page */
  7041.                #define PAGELEN   *((unsigned int far *) 0x44Clu)
  7042.                     /* current page length (regen buffer) */
  7043.                #define VIDOFFSET *((unsigned int far *) 0x44Elu)
  7044.                     /* offset from start of video */
  7045.                #define ROWCOUNT  *((byte far *) 0x484lu)
  7046.                     /* # rows minus 1 on display (EGA,PGA) */
  7047.                #define CHARHEIGHT *((unsigned int far *) 0x485lu)
  7048.                     /* character height: # bytes/char, # scan lines/char
  7049.                          (EGA,PGA) */
  7050.                #define CURSOR_UNDERBAR   (MODE==7)?0x0B0C:0x0607
  7051.                     /* cursor type: underbar (default) */
  7052.                #define CURSOR_HALFBLOCK  (MODE==7)?0x070C:0x0407
  7053.                     /* cursor type: half-block */
  7054.     
  7055.     
  7056.     
  7057.     
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.                                                               Page 105
  7067.  
  7068.                                  VARIABLE TYPES
  7069.     
  7070.           The following variable types have been defined:
  7071.     
  7072.                boolean = char           Howard.h
  7073.                byte = unsigned char     defined in TC.EXE. See Features.
  7074.                struct ddate             Datehk.h
  7075.     
  7076.     
  7077.     
  7078.                                 GLOBAL VARIABLES
  7079.     
  7080.           These variables are defined for one reason or another and used
  7081.           internally. None of these variables have to be initialized (see
  7082.           insertmode.) They are mainly used to return extra values found in
  7083.           certain functions or needed globally by other functions.
  7084.     
  7085.            Datehk variables:
  7086.     
  7087.            Keyboard variables:
  7088.     
  7089.                boolean key_extended;    /* TRUE if special key pressed,
  7090.                                            i.e. Alt-X, etc. */
  7091.                int key_status;          /* shift key status byte */
  7092.     
  7093.          Note: these variables are set by inkey() and getk(), and are
  7094.                checked by many other keyboard routines.
  7095.     
  7096.                boolean insertmode;      /* insert or overwrite mode? */
  7097.     
  7098.          Note: This variable is used internally by getstr() and getget().
  7099.                These functions do NOT initialize this variable. You MUST
  7100.                set insertmode to TRUE or FALSE before calling either
  7101.                function or unpredictable results may occur. Upon completion
  7102.                of this function, testing this variable will determine the
  7103.                input mode last used. Future versions will default
  7104.                insertmode to some value if it has not been set.
  7105.     
  7106.            Video variables:
  7107.     
  7108.                FRAMES: see video.h for frame[] declarations.
  7109.     
  7110.                byte char_attribute;     /* char attribute for output */
  7111.     
  7112.          Note: This variable is used by many output functions to set the
  7113.                attribute byte. For functions such as putstr() you can
  7114.                either call set_color() with the attribute desired or
  7115.                declare char_attribute as an extern and then set it
  7116.                yourself.
  7117.     
  7118.     
  7119.     
  7120.     
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.                                                               Page 106
  7133.  
  7134.                                 REVISION HISTORY
  7135.     
  7136.           Version 0.60  -  1-15-88
  7137.           ------------
  7138.           Over 30 new functions added:
  7139.             - Cal...(), Greg...(), Jul...(), fulltoddate(), shorttoddate()
  7140.             - dayofweek()
  7141.             - isBREAKon(), setBREAK()
  7142.             - isVERIFYon(), setVERIFY()
  7143.             - reboot()
  7144.             - isExtended(), Extendedtotal(), EMMversion()
  7145.             - isNetwork()
  7146.             - memory_strategy()
  7147.             - disktype()
  7148.             - set_handles()
  7149.             - DESQversion(), DESQfreeCPU()
  7150.             - isDoubleDOS(), DoubleDOSTaskSwitch(), DoubleDOSfreeCPU()
  7151.             - scrbuff()
  7152.             - cursor_blink()
  7153.             - ansi_call()
  7154.           Fixed a bug in isleapyear(). Previously, isleapyear() would
  7155.                determine years ending in 00 that were evenly divisible by 4
  7156.                to be leap years (i.e. 1600). The gregorian calendar (you
  7157.                know, 30 days hath September...) doesn't count those as leap
  7158.                years.
  7159.           Optimized the direct video access routines as well as possible
  7160.                using 100% C code. Previously they checked for vertical
  7161.                retrace. Now all direct accesses play with the video
  7162.                registers and other fun things, basically turning off the
  7163.                screen for a fraction of a second, performing the access,
  7164.                then turning the screen back on again. In the longer access
  7165.                functions (save_screen() to name one) I found changing 30
  7166.                bytes between screen blankings to be optimal. These changes
  7167.                have sped up the direct video access functions (putsay(),
  7168.                save_...(), restore_...()) by a factor or 3! These functions
  7169.                now take 1/3 the time they used to. If you find the screen
  7170.                to blink, or that there is snow (putsay() may experience
  7171.                miniscule snow when outputting long strings) please let me
  7172.                know and I'll see what I can do.
  7173.     
  7174.     
  7175.           Version 0.50  -  11-18-87
  7176.           ------------
  7177.           Initial release of TCHK
  7178.     
  7179.     
  7180.     
  7181.     
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.                                                               Page 107
  7199.  
  7200.                               FUTURE ENHANCEMENTS
  7201.     
  7202.           There are more functions on the way. If you have any favorites
  7203.           you would like to see, or need, drop me a line. In future
  7204.           releases, look for the following features:
  7205.     
  7206.                - direct screen accesses coded in assembler
  7207.                - some more video routines
  7208.                - enhancement of the get and put routines to support all
  7209.                  features found in the @...SAY...GET commands of dBase III+
  7210.                - enhancement of the put routines to support the 'backslash'
  7211.                  control characters like printf does (\n, \t, etc.)
  7212.                - more date functions (Julian, Gregorian, and more)
  7213.                - formats with ease
  7214.                - some sound functions
  7215.                - more menu interfaces (popups, Macintosh pulldown menus)
  7216.                - mouse functions
  7217.                - more EMS functions
  7218.                - more hardware id functions (cpu/numeric coprocessor type)
  7219.                - a general date converter, handling over 40 different date
  7220.                  formats with ease
  7221.                - a general time converter, handling a dozen different time
  7222.                - several math functions (integration, numerical methods,+)
  7223.                - software id functions (TSR, ANSI.SYS, VDISK.SYS, etc.)
  7224.     
  7225.     
  7226.           If there are some features you would like to see implemented, or
  7227.           you have any suggestions, comments or questions, please don't
  7228.           hesitate to contact me. I can be reached at:
  7229.     
  7230.                Howard Kapustein
  7231.                1695 Barbara Lane
  7232.                East Meadow, NY 11554
  7233.                Phone: (516) 481-9612
  7234.     
  7235.           or at the following bulletin boards:
  7236.     
  7237.                The Boss dBBS       (201) 568-7293
  7238.                The Tool Shop       (602) 279-2673
  7239.     
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.  
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.                                                               Page 108
  7265.  
  7266.     
  7267.     
  7268.                            APPENDIX A - DATE FORMATS
  7269.     
  7270.           The following date formats are supported by TCHK:
  7271.     
  7272.          TCHK Reference      Date Type                Format
  7273.          --------------      ---------                ------
  7274.          Greg                Gregorian (US)           MM-DD-YY
  7275.          GregEuro            Gregorian (European)     DD-MM-YY
  7276.          GregJap             Gregorian (Japan)        YY-MM-DD
  7277.          Cal                 Calendar                 YYMMDD
  7278.          CalCent             Calendar (w/Century)     YYYYMMDD
  7279.          Jul                 Julian (Type E)          special hashed number
  7280.          JulA                Julian (Type A)          YYDDD
  7281.          JulB                Julian (Type B)          YYYYDDD
  7282.          full                English (Full)           Month DD, YYYY
  7283.          short               English (Short)          Mon DD, YYYY
  7284.          ddate               struct ddate             see datehk.h
  7285.     
  7286.           - Gregorian units are common shorthand dates (in string format)
  7287.             with all leading zeros preserved
  7288.           - Calendar units are numeric representations (double)
  7289.           - Julian Type E is a special "magic" hashed number (double)
  7290.             representing the number of elapsed days since an initial date.
  7291.             Julian Type E numbers are valid for the years 1900-2100 (give
  7292.             or take a couple of months)
  7293.           - Julian Type A and B are ANSI defined formats (double)
  7294.             containing year (and century for type B) and the day of the  
  7295.             year
  7296.           - full are strings of the date with the full name of the month
  7297.           - short are strings of the date with the short abbreviation of
  7298.             the month
  7299.           - ddate is my own date structure defined in datehk.h
  7300.     
  7301.           In some instances date formats not specifically designed to hold
  7302.           the century may overflow. For example, converting CalCent
  7303.           formatted  20220401 (April 1, 2022) to Greg (MM-DD-YY) would
  7304.           result in the string "04-01-122". Be aware.
  7305.     
  7306.     
  7307.                               ! ! ! WARNING ! ! !
  7308.     
  7309.           Unless otherwise specified, date format conversion functions
  7310.           (GregtoCal, JulAtoddate, etc.) do NOT perform error checking. If
  7311.           you pass an invalid date (March 32, 1988) your result may be have
  7312.           a slight flaw in it (Gregorian dates) or be totally corrupted.
  7313.     
  7314.           Julian Type E numbers are valid for the years 1900-2100 (give or
  7315.           take a couple of months.)
  7316.     
  7317.     
  7318.     
  7319.     
  7320.  
  7321.  
  7322.  
  7323.  
  7324.  
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330.                                                               Page 109
  7331.  
  7332.                                      Index
  7333.     
  7334.     
  7335.     A                                         F
  7336.     Ansi_call       7, 106                    Fulltoddate     11, 34, 48, 60,
  7337.     Atrim           9                                         106
  7338.                                               G
  7339.     B                                         Getc_match      35, 41, 42, 46,
  7340.     Box             6, 10, 12, 49,                            50
  7341.                     74, 75, 78, 79,           Getddate        36
  7342.                     80, 81, 82, 99            Getdouble       37, 40, 43
  7343.                                               Getfname        38
  7344.     C                                         Getget          38, 39, 44, 105
  7345.     Cal             11, 33, 34, 48,           Getint          37, 40, 43
  7346.                     60, 106, 108              Getk            35, 41, 42, 46,
  7347.     Clear           7, 12, 13, 14                             50, 105
  7348.     Clear_typeahead      13                   Getk_match      35, 41, 42, 46,
  7349.     Cls             7, 12, 14                                 50
  7350.     Cursor_blink    15, 16, 17, 18,           Getlogical      35, 41, 42, 46,
  7351.                     71, 85, 106                               50
  7352.     Cursor_flip     15, 16, 17, 18,           Getreal         37, 40, 43
  7353.                     71, 85                    Getstr          39, 44, 105
  7354.     Cursor_off      15, 16, 17, 18,           Getyn           35, 41, 42, 46,
  7355.                     71, 85                                    50
  7356.     Cursor_on       15, 16, 17, 18,           Gotoxy          7, 38, 47, 68,
  7357.                     71, 85                                    70, 84, 100, 101
  7358.                                               Greg            11, 34, 48, 60,
  7359.     D                                                         106, 107, 108
  7360.     Dayofweek       19, 106                                          
  7361.     Dayofyear       20, 21, 28                H
  7362.     Daysleft        20, 21, 28                Horiz_line      10, 49, 99
  7363.     Ddatetolong     22, 23, 24, 67,                                          
  7364.                     94                        I
  7365.     Ddatetoshort    22, 23, 24, 67,           Inkey           41, 42, 46, 50,
  7366.                     94                                        105
  7367.     Ddatetostr      22, 23, 24, 67            Intlen          51
  7368.     Delay           25                        IsBREAKon       52, 59, 83, 87,
  7369.     DESQfreeCPU     26, 27, 106                               106
  7370.     DESQversion     26, 27, 106               IsCGA           53
  7371.     Diffddate       20, 21, 28                IsDoubleDOS     30, 31, 54, 106
  7372.     Disktype        4, 29, 106                IsEGA           53
  7373.     DoubleDOSfreeCPU     30, 31, 54,          IsEMSavail      32, 33, 55, 56
  7374.                          106                  IsExtended      33, 55, 56, 106
  7375.     DoubleDOSTaskSwitch  30, 31, 54,          IsHerc          53
  7376.                          106                  Isleapyear      57, 98, 106
  7377.                                               IsMDA           53
  7378.     E                                         IsNetwork       58, 106
  7379.     EMMversion      32, 55, 106               IsVERIFYon      52, 59, 83, 87,
  7380.     Extendedtotal   33, 55, 56, 106                           106
  7381.                                               
  7382.  
  7383.  
  7384.  
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.                                                               Page 110
  7397.  
  7398.     J                                         Save_screen     10, 49, 74, 75,
  7399.     Jul             11, 19, 34, 48,                           78, 79, 80, 99,
  7400.                     60, 102, 106,                             106
  7401.                     107, 108                  Scrbuff         74, 75, 78, 79,
  7402.                                                               80, 106
  7403.     L                                         Scroll_down     81, 82
  7404.     Leftstr         61                        Scroll_up       81, 82
  7405.     Lotus_setup     63, 66                    SetBREAK        52, 59, 83, 87,
  7406.     Ltrim           9                                         106
  7407.                                               SetVERIFY       52, 59, 83, 87,
  7408.     M                                                         106
  7409.     Memory_strategy 64, 106                   Set_color       68, 69, 70, 84,
  7410.     Menu_lotus      63, 65                                    105
  7411.     Midstr          61                        Set_cursor      15, 16, 17, 18,
  7412.     Monthexpand     22, 23, 24, 67,                           71, 85
  7413.                     94                        Set_handles     86, 106
  7414.                                               Set_mode        7, 72, 88
  7415.     P                                         Shorttoddate    11, 34, 48, 60,
  7416.     Putk            35, 36, 37, 40,                           106
  7417.                     43, 44, 68, 69,           Strcomma        51, 89
  7418.                     70, 84                    Strdel          90
  7419.     Putsay          68, 69, 70, 106           Strins          91
  7420.     Putstr          42, 46, 66, 68,           Strrep          92
  7421.                     69, 70, 84, 105           Strshleft       93
  7422.                                               Strshright      93
  7423.     R                                         Strtoddate      22, 23, 24, 67,
  7424.     Read_cursor     15, 16, 17, 18,                           94
  7425.                     47, 71, 85, 100,          Strtodol        89, 95
  7426.                     101                       Strtotime       96, 97
  7427.     Read_mode       72, 88                                          
  7428.     Reboot          5, 73, 106                T
  7429.     Restore_box     10, 49, 74, 75,           Timetostr       96, 97
  7430.                     78, 79, 80, 99                                          
  7431.     Restore_screen  10, 49, 74, 75,           V
  7432.                     78, 79, 80, 99            Valid_date      57, 98
  7433.     Rightstr        61                        Vert_line       10, 49, 99
  7434.     ROM_date        76, 77                                          
  7435.     ROM_id          76, 77                    W
  7436.     Rtrim           9                         Wherex          7, 47, 71, 100,
  7437.                                                               101
  7438.     S                                         Wherey          47, 71, 100, 101
  7439.     Save_box        10, 49, 74, 75,                           78, 79, 80, 99
  7440.     
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.